http://lasalas.net/irc/codepaste/view.php?cp_id=166
-------------------------------------------------------------
On line 35, im trying to find out how many albums the user currently has, by using mysql_num_rows on a query that selects id from albums where username= the persons username. I can echo out the query, and input it directly into mysql, and it will select the correct values in the table, however i get an error when i try to do mysql_num_rows.
There is multiple entries for the username i am trying, so thats not the problem.
There's alot of extra stuff in the code atm, please just ignore it(exists part)
Thanks in advance for any help
mysql_num_rows error
Moderator: General Moderators
tryMaybe there is some kind of error, then mysql will tell you.
btw: what is the error you get?
Code: Select all
$result = mysql_query("SELECT id FROM albums WHERE username='$username'");
$countrows = mysql_num_rows($result) or die(mysql_error());btw: what is the error you get?
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Unless you are using multiple database connections, there is no need to specify which to use in mysql_error() as the last one opened (and for most people this is the only one open) will be used.m3rajk wrote:note: volka's code misses one needed thing. assuming the connection is in a variable $db, it dhoulf have mysql_error($db) in place of mysql_error
Mac