Select from database

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
YoussefSiblini
Forum Contributor
Posts: 206
Joined: Thu Jul 21, 2011 1:51 pm

Select from database

Post 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
Alan01252
Forum Newbie
Posts: 12
Joined: Sun Aug 03, 2008 3:20 pm

Re: Select from database

Post by Alan01252 »

And echo $existCount; Shows a number?
YoussefSiblini
Forum Contributor
Posts: 206
Joined: Thu Jul 21, 2011 1:51 pm

Re: Select from database

Post 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 :)
Post Reply