Computer Webmaster Gaming Console Graphics Forum

Welcome to the Computer Webmaster Gaming Console Graphics Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

MK PitStop Main Earn $25 Earn Money Posting Extras Members Blogs Image Hosting User Pages
Go Back   Computer Webmaster Gaming Console Graphics Forum > Webmaster Forum > Website Coding > PHP
Register FAQ/Rules Become A V.I.P. Member Search Today's Posts Mark Forums Read

PHP PHP for some can be one of the hardest website programming codes, so do you need help on your PHP script, if it is php4, php5 or lower this is the place for you for any PHP help.

Google
Reply
 
LinkBack Thread Tools Display Modes
Old 07-01-2007, 3:58 PM   #1
Wm
 
Wm's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default "Paging" (First/Previous/Next/Last to limit # of listings per page)

I'm trying to get a handle on the best way to handle setting up my listings
so that I display groups of about 25 records per page. I currently have a
page that returns over 1,000 names/addresses, which is obviously not very
efficient. Does anyone have any suggestions on the best way to approach
this, or recommendations on what pitfalls to avoid? I'm assuming that I need
to be able to count the total number of records that match the search
criteria, possibly at the top of the page before any HTML output, then find
some way to identify/track the first record, next record, etc...? I know I
should replace my existing query with something that limits it to about 25
records at a time, right?

Thanx in advance for any/all suggestions!
Wm

<?php include('dbconnect.php');
echo "<TABLE width=\"100%\" align=\"center\" border=\"0\"
cellpadding=\"0\" cellspacing=\"0\">";
$query="SELECT * from artists
WHERE mentor='0'
ORDER BY country DESC, state ASC, city ASC, lastname ASC";
$result=mysql_query($query) or die(mysql_error("Could not execute
query."));
while($row = mysql_fetch_array($result)) {
$artistID = $row['artistID'];
$firstname = (ucwords(strtolower($row['firstname'])));
$lastname = (ucwords(strtolower($row['lastname'])));
$mentor= $row['mentor'];
$city= (ucwords(strtolower($row['city'])));
$state= (strtoupper($row['state']));
$country= (strtoupper($row['country']));
//....etc....
echo "
<TD align=\"left\" valign=\"top\" width=\"50%\"><FONT size=\"2\"
face=\"Arial, Helvetica, sans-serif\">
<A HREF=\"javascript:;\"
onClick=\"openProfile('artist.php?artistID=".$arti stID.
"','Artist','resizable=yes,width=750,height=400')\ ">".$firstname."
".$lastname."</A></FONT></TD>
//....etc....




 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Advertisements
Old 07-01-2007, 3:58 PM   #2
Hormel Bait
 
Hormel Bait's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default "Paging" (First/Previous/Next/Last to limit # of listings per page)

I don't know if this is an option for you, but you could try ADODB, its got
a great pager built in,

http://php.weblogs.com/ADOdb
http://phplens.com/adodb/tutorial.im...rev ious.html

hth

--b

"Wm" <LAshooter@hotmail.com> wrote in message
newsnyVa.776353$Ho4.5611438@news.easynews.com...
> I'm trying to get a handle on the best way to handle setting up my

listings
> so that I display groups of about 25 records per page. I currently have a
> page that returns over 1,000 names/addresses, which is obviously not very
> efficient. Does anyone have any suggestions on the best way to approach
> this, or recommendations on what pitfalls to avoid? I'm assuming that I

need
> to be able to count the total number of records that match the search
> criteria, possibly at the top of the page before any HTML output, then

find
> some way to identify/track the first record, next record, etc...? I know

I
> should replace my existing query with something that limits it to about 25
> records at a time, right?
>
> Thanx in advance for any/all suggestions!
> Wm
>
> <?php include('dbconnect.php');
> echo "<TABLE width=\"100%\" align=\"center\" border=\"0\"
> cellpadding=\"0\" cellspacing=\"0\">";
> $query="SELECT * from artists
> WHERE mentor='0'
> ORDER BY country DESC, state ASC, city ASC, lastname ASC";
> $result=mysql_query($query) or die(mysql_error("Could not execute
> query."));
> while($row = mysql_fetch_array($result)) {
> $artistID = $row['artistID'];
> $firstname = (ucwords(strtolower($row['firstname'])));
> $lastname = (ucwords(strtolower($row['lastname'])));
> $mentor= $row['mentor'];
> $city= (ucwords(strtolower($row['city'])));
> $state= (strtoupper($row['state']));
> $country= (strtoupper($row['country']));
> //....etc....
> echo "
> <TD align=\"left\" valign=\"top\" width=\"50%\"><FONT size=\"2\"
> face=\"Arial, Helvetica, sans-serif\">
> <A HREF=\"javascript:;\"
> onClick=\"openProfile('artist.php?artistID=".$arti stID.
> "','Artist','resizable=yes,width=750,height=400')\ ">".$firstname."
> ".$lastname."</A></FONT></TD>
> //....etc....
>
>
>
>



 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Old 07-01-2007, 3:58 PM   #3
Tony Marston
 
Tony Marston's Avatar
 
Posts: n/a
My Photos: (0)

Banked:
MK Cash: $

I am Worth:
MK Cash: $
Donate

Recent Blog: None

Default "Paging" (First/Previous/Next/Last to limit # of listings per page)

"Wm" <LAshooter@hotmail.com> wrote in message news:<pnyVa.776353$Ho4.5611438@news.easynews.com>. ..
> I'm trying to get a handle on the best way to handle setting up my listings
> so that I display groups of about 25 records per page. I currently have a
> page that returns over 1,000 names/addresses, which is obviously not very
> efficient. Does anyone have any suggestions on the best way to approach
> this, or recommendations on what pitfalls to avoid? I'm assuming that I need
> to be able to count the total number of records that match the search
> criteria, possibly at the top of the page before any HTML output, then find
> some way to identify/track the first record, next record, etc...? I know I
> should replace my existing query with something that limits it to about 25
> records at a time, right?
>
> Thanx in advance for any/all suggestions!
> Wm
>
> <snip useless code>
>


You don't need any javascript to do paging. You need to use the LIMIT
clause in your sql SELECT statement in order to return a different set
of records each time. Before you do the SELECT you need to count the
records that match so you can determine the last page number. Take a
look at http://www.tonymarston.net/php-mysql...jects.html#a4d
for examples of how I handle this in an abstract database class.

Tony Marston
http://www.tonymarston.net//
 
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
Featured Websites
Free Space
Free Space
Free Space Free Space
Reply
Tags: , , , ,




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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
font color="gold" (or whatever) where's the proper html for this ("#ffffa0") type of thing? Big Bill HTML 4 07-01-2007 2:06 PM
Play "FREE" Casino Games and WIN "Real Cash" at GOCG! Affiliate Manager Affiliate Programs 0 06-12-2007 7:58 PM
"""*" FREE internet moneymaker """*" Dave Building An Internet Business 0 06-11-2007 12:18 AM
some shortcut keys not working anymore-----help"""""""" Kadaitcha Man Windows 1 05-28-2007 11:28 PM
Pront Page 2003 "View Tabs" Thomas Hupfeld Website Reviews And Website Questions 2 05-27-2007 11:14 PM


Featured Websites




All times are GMT +1. The time now is 3:17 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.0.0
Cheap Computers
MK PitStop Copyright 2005 - 2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98