[thelist] php/mySQL query problem

Tom Dell'Aringa pixelmech at yahoo.com
Wed Jul 23 15:50:59 CDT 2003


I'm am trying to pull some categories in a php function from my
database. I do have a valid connection to my DB, and I am referencing
the correct table. Here is my function:

function PrintCategories()
	// get cats
	$result = @mysql_query(
	"SELECT categoryID FROM category"
	$items = mysql_num_rows($result);

        // then do stuff

I've left the while loop out after for clarity since I don't get that
far. The error is:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL
result resource 

This is referring to my $result query. I can't understand why this is
erroring out, I use this in many places, same code. There are 2 lines
of data in the db table. I do use the same variable names in other
functions ($result etc,) so I tried changing them. It didn't
matter...I'm lost as to what it can be and it must be plain as the
nose on my face...



http://www.pixelmech.com/ :: Web Development Services
http://www.DMXzone.com/ :: Premium Content Author / JavaScript / Every Friday!
http://www.maccaws.com/ :: Group Leader
[Making A Commercial Case for Adopting Web Standards]

"That's not art, that's just annoying." -- Squidward

More information about the thelist mailing list