help with phpmysql selecting data based on selected category not displaying

here is my code, guys i need some help been working on it for almost 5 days now…

[php]include ‘databases/connect.php’;
$rec_limit = 10;
$connection = mysqli_connect(‘localhost’, ‘, '***’, “my_db”);

if(mysqli_connect_errno()) {
echo "Erreur survenue! " . mysqli_connect_error();
}
mysqli_select_db($connection, ‘my_db’);

$sql = “SELECT count(id) FROM tblpersonallsiting”;
$retval = mysqli_query($connection, $sql);
if(! $retval )
{
die('Impossible de se connecter! ’ . mysql_error());
}
$row = mysqli_fetch_array($retval, MYSQL_NUM );
$rec_count = $row[0];

if( isset($_GET{‘page’} ) )
{
$page = $_GET{‘page’} + 1;
$offset = $rec_limit * $page ;
}
else
{
$page = 0;
$offset = 0;
}
if(isset($_POST[‘category’])){
$categ = “SELECT DISTINCT (category) FROM tblpersonallsiting LIMIT 1”;
$cat = mysqli_query($connection, $categ) or die(mysqli_connect_error());

while($cate = mysqli_fetch_array($cat, MYSQL_ASSOC)){
$category = $cate[‘category’];

$sql = “SELECT * FROM tblpersonallsiting WHERE category =’”.$category."’ ORDER by id DESC LIMIT $offset, $rec_limit";
$retval= mysqli_query($connection, $sql);

if(! $retval )
{
die('Could not get data: ’ . mysql_error());
}
while($row = mysqli_fetch_array($retval, MYSQL_ASSOC)) {

 echo '<table width="" cellpadding="5" cellspacing="5" border="0" style="margin:0 auto; margin-top:5px; border-bottom:1px inset;">';
 if(empty($row['username'])){
	 echo'<tr><td style="border:0px outset;" id="gen"><h1><strong>' . $row['ent_name'] . '</strong></h1></td></tr>';
 }
 else{
echo '<tr><td style="border:0px outset;" id="gen"><h1><strong>' . $row['username'] . '</strong></h1></td></tr>';
 }
echo '<tr><th style="border:0px outset;" id="gen"><strong>' . $row['date'] . '</strong> | <strong>Mis a jour :</strong> ' . $row['last_updated'] . '</th></tr>';

echo '<tr><th>Picture</th><th>Category</th><th>Description</th><th>Ville</th></tr>';	

				$photo= $row['photo'];
					if (empty($photo)) {
					$photo = "default.png";
					echo '<td><img src="uploaded/'.$photo.'" width="120px" height="120px"></td>';					
					}else{
echo '<td><img src="uploaded/'.$row['photo'].'"" width="140" height="120"/></td>';
					}
/*echo '<td class="cat"><p>' . $row['category'] . '</p></td>'*/
echo '<td class="desc"><p>'. $row['description'] . '</p></td>';
echo '<td><p>'. $row['ville'] . '</p></td>';
echo '</table>';

}
}}
if( $page > 0 )
{
$last = $page - 2;
echo “<a href=“general.php?page=$last”>10 Derniers Articles |”;
echo “<a href=“general.php?page=$page”>10 Prochains Articles”;
}
else if( $page == 0 )
{
echo “<a href=“general.php?page=$page”>10 Prochains Articles”;
}
else if( $left_rec < $rec_limit )
{
$last = $page - 2;
echo “<a href=“general.php?page=$last”>10 Derniers Articles”;
}

mysqli_close($connection);
?>[/php]

no errors no data displayed! my errors are configured well i think so.

You should use a proper editor / IDE, it will make it really easy to spot errors like this.
http://www.phphelp.com/forum/the-occasional-tutorial/make-your-life-simpler-use-an-ide!/

Sponsor our Newsletter | Privacy Policy | Terms of Service