I used php on my web page and it displays part of php script on my web page.
Does anybody know what I am doing wrong?
Here is link to the problem page and php script that I used on that page.
http://www.youngsmall.com/cgi-local/shop.pl/page=index222.htm
<?php
$link = mysql_connect("xxxxx","xxxx","xxxx")
or die ("Could not connect");
if (! @mysql_select_db("xxxxx") ) {
echo( "<P>Unable to locate the inventory " .
"database at this time.</P>" );
exit();}
$itemx = "6505";
$sql = "SELECT quantity FROM inventory WHERE item = '$itemx'";
$result = mysql_query($sql,$link);
$row = mysql_fetch_array($result);
// you have to fetch the result into an array to access the info in the db
$num = $row["quantity"];
// NOW we can compare $num 😉
if ($num < 1) {
echo "<b><font color=\"#FF0000\">Out of Stock</font></b>";
} else {
echo "<b><font color=\"#0000FF\">In Stock</font></b>";
}
mysql_close($link);
?>
Thanks for your time.
Tony