Here is the link to the problem page,

This PHP script shows up below "buy now" button.
Can anybody tell me what I am doing wrong?
This is script that I am using on each buy buttons,
$link = mysql_connect("xxxxx","xxxxxx","xxxxxx")
        or die ("Could not connect");

 if (! @mysql_select_db("xxxxx") ) {
 echo( "<P>Unable to locate the inventory " .
  "database at this time.</P>" );

  $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>";


Thanks for your time.

PHP Database Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to