View Full Version : How do you use $db->num_rows?
DrewM
03-30-2006, 10:52 PM
Well I'm doing a script that allows users to only enter once. And I was wondering how to do this?
Code Monkey
03-31-2006, 02:04 AM
You might want to put up some more info than that. It's tough to help when it's so vague. Plus, when you ask questions where coders hang out, you'll find that you get more of a responce and more help if you post what code you have.
Adrian Schneider
03-31-2006, 04:57 AM
$db->num_rows($resource) is a function, it returns the number of found rows from the given results ($resource).
$result = $db->query_read("
SELECT *
FROM table
WHERE rating > 3
LIMIT 5
");
echo $db->num_rows($result);
That should display an integer between 0 and 5.
Assuming your table has a userid field, do a query for that userid and if $db->num_rows() returns true then deny them access. As JumpD said, we can't really help much without more info.
Good luck.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.