Unknown column 'a' ??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

Unknown column 'a' ??

Post by C_Calav »

hi guys,

been solving alot of errors with this "or die(mysql_error()" been great, but ive run into this:

Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /var/users/modelair/modelaircraft.co.nz/htdocs/cart.php on line 54
Unknown column 'a' in 'where clause'

what does this mean? i dont have anything refering to a column a?

thanx


Code: Select all

<?php

      $result = mysql_query("SELECT count(*) FROM cart WHERE cookieId = '" . GetCartId() . "' AND P_Stock = $P_Stock"); 
      $row = mysql_fetch_row($result) or die(mysql_error()); 
      $numRows = $row[0]; 
?>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

is $P_Stock non-numeric? if so, put single quotes around it. Either way, you have an error in your sql probably
Post Reply