Re: if then else statement not working

From: Date: Thu, 05 May 2005 17:57:37 +0000
Subject: Re: if then else statement not working
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-214567@lists.php.net to get a copy of this message
Anasta wrote: > What am i doing wrong here, the output is always 'empty' > > <?php > $result = mysql_query("SELECT username FROM users > WHERE seatnum='seat1'") or die(mysql_error()); > > if (seatnum == seat1) { > echo username; > } else { > echo 'empty'; > } > ?> That doesn't even look like PHP code. In PHP variables have $ in front of them, and you are only sending a query, you aren't assignining anything to the variables. And further, your actual SQL query is already applying that restriction, so any usernames returned by the query will by definition have their seatnums be set to 'seat1' in the database. -Rasmus

« previous php.general (#214567) next »