Query Error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've been racking my brain and the web for finding a solution and no
luck so far.

Here's the form:
$display_block .= "<HR>Input item: <form method=post
action=\"additem.php\">&nbsp;&nbsp;&nbsp;&nbsp;Item ID:<input
type=\"text\" name=\"sel_item_id\"><BR>Quantity: <select
name=\"sel_item_qty\">";
$display_block .= "<option value=\"0\">0</option><option value=\"1\"
selected>1</option>";
for ($i=2; $i < 301; $i++){
 $display_block .= "<option value=\"$i\">$i</option>";
}
$display_block .= "</select><input type=\"hidden\" name=\"SESSID\"
value=\"$PHPSESSID\"></td><td><input type=\"hidden\" name=\"url\"
value=\"$_SERVER[PHP_SELF]\"><BR>Price:<input type=\"text\"
name=\"sel_item_price\" size=\"5\"><input type=\"submit\"
name=\"submit\" value=\"Add to Cart\"></form>";


And here is the additem.php file where it check for the info in the
field and it is erroring out.

  //validate item and get item and price
//  $get_iteminfo = "select item_num, description from GCN_items where
'item_num' LIKE '%$_POST[sel_item_id]'";
  $get_iteminfo = "select * from GCN_items where 'item_num' LIKE
'%$_POST[sel_item_id]%'";
  $get_iteminfo_res = mysql_query($get_iteminfo) or die(mysql_error());
  
  if (mysql_num_rows($get_iteminfo_res) < 1){
    //invalid id, send away and show query codes
//    header("Location: ohcrud.php");
   print "the query I just ran was: $get_iteminfo<BR>\n";
   print "the query I just ran was: $get_iteminfo_res<BR>\n";
   echo mysql_num_rows($get_iteminfo_res);
    exit;


I did have = instead of LIKE before, but the results are the same.

GCN_items has the code I am looking for in it but the query is showing
no results.

HELP!

Robert

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Bureaucrats cut red tape, lengthwise.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux