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!
tags when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I am only getting one row returned from this query....
See it here [url=http://onestopauctionshop.com/preview/test.php?category=Motorcycle%20Parts]http://onestopauctionshop.com/preview/test.php?category=Motorcycle%20Parts[/url]
Here is the code:
Sami wrote:
BTW [php_man]mysql_num_rows[/php_man]() returns an int, not a boolean var...so line 11 needs to be changed.
Isn't any non-zero value treated as TRUE? So as long as 1 or more records are returned the code within the if() should be executed. I always assumed this.
I too am getting 2 rows returned.
Without a resume of the data, it's impossible to check the validity of the SQL. How many rows do you get when you execute the command in your SQL editor directly?
Sami wrote:Indeed, but it's bad coding practice IMO.
it's not as long as code is clear and anyone can understand it, IMO. All these tricks (automatic typecasting etc.) are sometimes abused though. There was good book on C++ idioms by Jeff Alger discussing how such a tricks could be used to make your code clear and quick.