vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How do you use $db->num_rows? (https://vborg.vbsupport.ru/showthread.php?t=111748)

DrewM 03-30-2006 09:52 PM

How do you use $db->num_rows?
 
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 01: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 03:57 AM

$db->num_rows($resource) is a function, it returns the number of found rows from the given results ($resource).

PHP Code:

$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.


All times are GMT. The time now is 11:04 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01459 seconds
  • Memory Usage 1,709KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete