Re: Re: If statement duplicating mysql records?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Jun 19, 2007, at 5:10 PM, Roberto Mansfield wrote:

Jason Pruim wrote:
Okay, so I have a question... Probably pretty easy, but why would my if
statement show more records then what are in the database?

if($row[5] =='Level4'){ // White Highlight
        }// End of Level 4
        else
        {// Green Highlight
        }// End of Unclassified

If I have a record that matches Level4 it will display both with the
$Level4 color and the $unclassified color. Ideally it would only show up
under the $Level4 category if it's Level4...  If that makes sense.

I don't think IF is the culprit. I'm guessing you have a bad join in
your sql query so you are getting back more records than you expect.
Have you run the query directly in to see what your results are?


Hi Roberto,

Thanks for the reply! The query I'm using to grab the records from MySQL is a very simple one:
$sql  = "SELECT * FROM tasks WHERE completed='0' order by id";

I don't totally understand yet why it happened, but Jim's suggestion worked great.

Thanks though!


Roberto

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux