Current location: Hot Scripts Forums » Programming Languages » PHP » Displaying stuff from a mySQL database


Displaying stuff from a mySQL database

Reply
  #1 (permalink)  
Old 08-20-05, 05:32 PM
blackcode blackcode is offline
Newbie Coder
 
Join Date: Jul 2005
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Displaying stuff from a mySQL database

i know how to display things in a mysql database, what i actually need is to limit my while loop to only display the first 20 things in the database and then have a next button to see the next 20 things in the database.
Reply With Quote
  #2 (permalink)  
Old 08-20-05, 05:59 PM
Andy_1984 Andy_1984 is offline
Newbie Coder
 
Join Date: Jun 2005
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
and you have the balls to call me a lamer, ever heard of pagination ?
Reply With Quote
  #3 (permalink)  
Old 08-20-05, 06:32 PM
blackcode blackcode is offline
Newbie Coder
 
Join Date: Jul 2005
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
lol, nope... didnt you say you were going somewhere else for help... and maybe you should go back and read what i posted the last time before you talk **** anyways i dont have time for this... and dont reply to this, i dont need your bs. what i need is a answer to my question now does anyone have the help cause obviously this fruitcake doesnt.

Last edited by NeverMind; 08-20-05 at 06:47 PM.
Reply With Quote
  #4 (permalink)  
Old 08-20-05, 06:46 PM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
I'd like to ask you both to stop this immediately!
no more flamming.


http://www.phpsimplicity.com/tips.php?id=1
http://www.programmingtalk.com/showt...ght=pagination
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Reply With Quote
  #5 (permalink)  
Old 08-20-05, 06:56 PM
blackcode blackcode is offline
Newbie Coder
 
Join Date: Jul 2005
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
i appoligize, im not here to flame.. i gave it up i really dont care about this guy what so ever it is a big waste of time... i just had to reply to it. i didnt think i insulted him at all in that... sorry
Reply With Quote
  #6 (permalink)  
Old 08-20-05, 09:00 PM
Andy_1984 Andy_1984 is offline
Newbie Coder
 
Join Date: Jun 2005
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
if you would read my post you would see i gave you an answer.

treat those as they would treat you
Reply With Quote
  #7 (permalink)  
Old 08-20-05, 10:14 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Quote:
Originally Posted by blackcode
i know how to display things in a mysql database, what i actually need is to limit my while loop to only display the first 20 things in the database and then have a next button to see the next 20 things in the database.
You know, you could probably solve half your programming problems by using Google. Just search for the answer and you'll almost certainly find it. People here get annoyed when they see someone asking questions without even *trying* to find it themselves first. I mean, really, this is NOT that hard to find using Google or any search engine. The fact that you haven't made the slightest apparent attempt at solving this yourself doesn't make me want to help you.

Now, if you came in here asking if anyone had pagination code to share, no problem. That's different. I have pagination code (which I've posted here before), but you wouldn't even take the time to look and see if this question had been answered before. Why should I have to post it repeatedly because you won't take a moment to try and help yourself?

Now, go to Google and type "php pagination example". Voila, problem solved.
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Reply With Quote
  #8 (permalink)  
Old 08-21-05, 09:01 AM
blackcode blackcode is offline
Newbie Coder
 
Join Date: Jul 2005
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
ok what am i suppose to search in google... "php 20 mysql query" like i didnt know what the **** it was called or i wouldnt be asking, and actually i did look though www.php.net and a php and mysql for dummies book so maybe you should keep comments to yourself when you dont know wtf is going on
Reply With Quote
  #9 (permalink)  
Old 09-11-05, 09:30 AM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Quote:
Originally Posted by blackcode
ok what am i suppose to search in google... "php 20 mysql query" like i didnt know what the **** it was called or i wouldnt be asking,
I can't help it if you're too ignorant to even know what to search for.


Quote:
Originally Posted by blackcode
and actually i did look though www.php.net and a php and mysql for dummies book so maybe you should keep comments to yourself when you dont know wtf is going on
Lol, what a baby. I was going to copy a full set of pagination code in here for you, but I don't help ungrateful wankers.
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Reply With Quote
  #10 (permalink)  
Old 09-11-05, 02:29 PM
inContrast inContrast is offline
Newbie Coder
 
Join Date: Sep 2005
Location: Vancouver, BC, Canada
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Whatever, I'm new here, so I'm just helping everyone.

Code:
//Couple Quick constant variables.
define("Jump_Count", "20");

//Now, how many entries are in the database?
$numCount=mysql_num_rows(mysql_query("SELECT * FROM table"));
//Returns: 24

//Have they clicked "Next" yet? if not, define the start as "0"
if(!isset($_REQUEST['start']) {
   $start=0;
}

//Now, let's display some.
//This will display the next 20 enteries after "Start"
while($ShowInfo=mysql_fetch_array(mysql_query("SELECT * FROM table LIMIT $start, Jump_Count))) {
   //Display whatever
}

//Should we display The Next and Previous links or not?
if($_REQUEST['start']==0||$_REQUEST['start']=='') {
   echo '<a href=thispage.php?start=' .$start-20. '><- Previous</a>
}
echo '||';
if($numCount>$start+20) {
   echo '<a href=thispage.php?start=' .$start+20. '>Next -> </a>
}
I apologize for any syntax errors or anything like that, at work and don't have access to any good color code editiors or anything. However, the threory should be fairly sound.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Form to update a MySQL database? Scoobler PHP 9 09-04-08 01:41 AM
Flat file vs mysql database Imusion PHP 5 06-13-06 12:10 PM
Need help to store images in mysql database sjems PHP 2 04-12-05 05:36 AM
sorting stuff from a mysql database in a - b - c Leipe_Po PHP 3 03-19-05 09:24 AM
Error while creating database (Errornumber 2002: "Can't connect to local MySQL server lylesback2 PHP 5 04-11-04 01:37 PM


All times are GMT -5. The time now is 07:02 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.