Here is my code
$itemSelect="select * from items where gender='men' and type='suite'";
$itemQuery=mysql_query($itemSelect) or die(mysql_error());
$num=count($itemQuery);
echo $num;
if($itemQuery)
{
echo "I am here";
echo "<table>";
while($row = mysql_fetch_array($itemQuery))
{
$photo=$row['photo'];
$name=$row['name'];
$price=$row['price'];
echo "<tr><td>". $photo ."</td><td>" .$name ."</td><td>" .$price ."</td> </tr>";
}
echo "</table>";
}
else
{
echo "There is some mistacke";
die();
}
So here $num=count($itemQuery);
shows me that there is 1 item that satisfies the search but the loop is never executed what could be the problem? Thanks in advance.
foreach ($itemQuery as $value) { }
$itemQuery
is a resultset and he is fetching the records,foreach
will not make a difference. @OP can you do aecho mysql_error();
after executing the query?