View Single Post
Old 06-19-2009, 03:22 AM   #6 (permalink)
Village Idiot
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Quote:
Originally Posted by 9three View Post
So this is what I thought of but its returning false on anything bigger than 1

PHP Code:
$mysqli = new mysqli('localhost''root''''store');
$result $mysqli->query("SELECT ID FROM products WHERE ID = '$input_id'");
  
  if (
$result == $input_id)
    return 
true;
  return 
false
I'm not sure if that's what you meant by allowing SQL do the work?
SQL is doing all the work you need to, just count the rows (mysql_num_rows). This is not incredibly efficient, but better ways would require more advanced SQL. Once again, I highly seggust you learn to code SQL before making a data driven script.
__________________

Village Idiot is offline  
Reply With Quote