Re: Wrong solution!!!!
| From: | Julie Meloni | Date: | Sat, 21 Jul 2001 21:44:25 +0000 |
| Subject: | Re: Wrong solution!!!! | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-10633@lists.php.net to get a copy of this message | ||
T> $itemx = "15109";
T> $num = mysql_query("SELECT quantity FROM inventory WHERE item =
T> '$itemx'",$link);
T> if ($num < 1) {
T> echo "<b><font color=\"#FF0000\">Out of Stock
T> $result</font></b>";
T> } else {
T> echo "<b><font color=\"#0000FF\">In Stock
T> $result</font></b>";
T> }
T> I want my inventory quantity with known item number to compare with
T> ($num<1), but didn't work.
You have not yet gotten the result of the query. Use mysql_result()
or any of the result-related functions to get the actual result of the
query.
All you're doing now is executing the query, which, if you've
connected successfully and there's nothing wrong with your sql, will
return true.
Julie Meloni
julie@thickbook.com
"PHP Essentials" & "PHP Fast & Easy"
--- www.thickbook.com ---