Jump to content

[SOLVED] PHP/MySQL not returning any results


itsjames

Recommended Posts

Hi,

This is probably quite a simple error, so appologies if I'm just being stupid!

 

My script queries the database to select all fields from my table where the category matches what I've specified (in this case, heating):

$item = mysql_query("SELECT * FROM items WHERE category = heating");

 

The following code displays the result in a table:

while($result = mysql_fetch_array($item))
{
echo( "<table width=\"450\" border=\"0\"><tr>" );
echo( "<td colspan=\"2\" class=\"resultTitle\">" . $result['name'] . "</td>" );
echo( "<td rowspan=\"3\" align=\"center\" width=\"110\" height=\"110\"><a href=\"#\" onclick=\"window.open(\'images/database/" . $result['image'] . ".jpg\',\'Photo\',\'width=600,height=550,scrollbars=yes\')\">" );
echo( "<img src=\"images/database/" . $result['image'] . "\" border=\"0\" height=\"110\" width=\"110\" /></a></td></tr>" );
echo( "<tr><td width=\"170\"><p><strong>Category:</strong> " . $result['category'] . "<br>" );
echo( "<strong>Subcategory:</strong> " . $result['sub_category'] . "</p></td>" );
echo( "<td width=\"170\"><strong>Dimensions:</strong> " . $result['dimensions'] . "<br>" );
echo( "<strong>Price:</strong> £" . $result['price'] . "</td></tr>" );
echo( "<tr><td colspan=\"2\"><strong>Self collect available:</strong> " . $result['self_collect'] . "</td></tr>" );
echo( "<tr><td colspan=\"3\">" . $result['long_description'] . "</td></tr></table>" );
}

I assume my fault is somewhere within this block of code, as when I run the script, nothing is echoed. I have checked that the database login details are correct, and that the query works.

 

I am using PHP 4.4.8 MySQL 5.0.22

 

All help appreciated

 

Regards

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.