Page 1 of 1

Select from database

Posted: Fri May 18, 2012 3:37 am
by YoussefSiblini
Hi,
I have no idea why this is happening,

I have this code:

Code: Select all

$sql = mysql_query("SELECT * FROM logis WHERE OrderNum ='$invoice' LIMIT 1"); 
$existCount = mysql_num_rows($sql); 
//if Order Number does not exist add the file details into the table database
if ($existCount == 0)
{ echo "Order Number does not exist"; }
else if ($existCount > 0)
{ echo "Order Number exist"; }
 
I am 100% sure that the $invoice does not exist in the logis table and I keep getting "Order Number exist".

Joe

Re: Select from database

Posted: Fri May 18, 2012 4:31 am
by Alan01252
And echo $existCount; Shows a number?

Re: Select from database

Posted: Fri May 18, 2012 4:36 am
by YoussefSiblini
Thanks for your reply,
I just found the error, in my database the OrderNum should be an integer, and the $invoice I am passing has a letter R inside it after I took the Letter off it is working fine now.
Stupid me lool :)