Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Whats is wrong with the following code

Status
Not open for further replies.

inusrat

Programmer
Feb 28, 2004
308
CA
echo "$criteria";

if ($criteria =! 0)
{
$string="SELECT * FROM orders where status ='$criteria' LIMIT $start,$numentries ";

echo "$criteria";

}

Before the if statement I get the value "New" for criteria, which is what I should get, but with in the if statemnt it changes to "1", and my sql fails.........

 
first of all, you probably meant to change this line around:

if($criteria =! 0)

to

if($criteria !=0)

Hope that helps.

Rninja

sl_sm.jpg

 
Try this...

if ($criteria != 0){
$string="SELECT * FROM `orders` where `status` ='" . $criteria . "' LIMIT $start, $numentries";
echo "$criteria";
}
 
or:
if ($criteria != "")


Known is handfull, Unknown is worldfull
 
rninja has the right answer.

You typed "if ($criteria =! 0)". The inner part of the if says "assign the value of 'not zero' to $criteria" and "not zero" evaluates to, you guessed it... one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top