vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   per page??? (https://vborg.vbsupport.ru/showthread.php?t=44913)

GeorgeofCS 10-23-2002 08:26 PM

per page???
 
Ok I'm attempting to alter a pice of code I rewrote for other purposes. The only problem is that I need the script to show say 10 per page. Can anyone help?

Here's the bit of code.

PHP Code:

if ($action=="") {
  include(
"./global.php");
  
//check usergroup of user to see if they can use Profile
  
if ($bbuserinfo[userid]==0) {
    
show_nopermission();
  }

  
$sponsors=$DB_site->query("SELECT id,name,sponban,sponlink,sponpoint,sponexp,sponhits FROM sponsors WHERE (sponexp<=sponhits OR sponhits=0) ORDER BY id DESC");
$c 0;
  while (
$sponsor=$DB_site->fetch_array($sponsors)) {

    
$sponsorbody .= "<br><a href=\"sponsor.php?s=$session[sessionhash]&action=sponsee&sponid=$sponsor[id]\" target=\"_blank\"><img src=\"$sponsor[sponban]\" border=\"0\"></a><br>Visiting $sponsor[name] is worth $sponsor[sponpoint] points.<br>";
    
$c $c 1;
  }
  
  if (
$c==0) {
    
$sponsorbody .= "No Sponsors found";
  }
  
  
$sponsorbody .= "";
  eval(
"dooutput(\"".gettemplate("sponsor_main")."\");");



Velocd 10-25-2002 05:53 PM

You will need to replace this:

PHP Code:

$sponsors=$DB_site->query("SELECT id,name,sponban,sponlink,sponpoint,sponexp,sponhits FROM sponsors WHERE (sponexp<=sponhits OR sponhits=0) ORDER BY id DESC"); 

With this:

PHP Code:

$sponsors=$DB_site->query("SELECT id,name,sponban,sponlink,sponpoint,sponexp,sponhits FROM sponsors WHERE (sponexp<=sponhits OR sponhits=0) LIMIT 10 ORDER BY id DESC"); 

Adding the LIMIT 10 attribute specifies how many sponsers should be grabbed per page. You will need to do some more coding though to implement pages, etc.


All times are GMT. The time now is 08:37 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.01016 seconds
  • Memory Usage 1,722KB
  • 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
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)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