I need some help with paging....

Page 1 of 1

14 Replies - 1050 Views - Last Post: 01 September 2009 - 09:47 PM Rate Topic: -----

#1 hockey97  Icon User is offline

  • D.I.C Regular

Reputation: -77
  • View blog
  • Posts: 300
  • Joined: 25-September 08

I need some help with paging....

Post icon  Posted 25 September 2008 - 09:51 AM

HI, I am new to this forum but I have been on other web development forums.

Ok I have already made a php script of creating the links ect.

Well I can't seem to get the page 1 page 2 links to work to show the different pages.
well here is the code:

<?php
include("/home/aaron/websites/sharedscripts/mysqldata.php");
session_start();
//if($_SESSION["username"]==""){
//$_SESSION["logged"]=0;
//exit("Sorry your not logged in, please log in.");}
//if ($_SESSION["logged"] == 1) {
if ($_GET["act"]=="view") {
$user = "root"; 
$pass = "cooldude1"; 
$db = "Market";
$host="localhost";
$id=$_GET["id"];
$state=$_SESSION['state'];
mysql_connect($host,$user,$pass) or die("ERROR:".mysql_error());
mysql_select_db($db) or die("ERROR DB:".mysql_error()); 
$sql = mysql_query("SELECT * FROM postings WHERE id = '$id' AND state = '$state'");
$result=mysql_fetch_array($sql);
$image=$result["Item_Image"];
$title=$result["Item_type"];
$message=$result["Message"];
echo"<html>
<head>
<link rel=\"stylesheet\" type=\"text/css\" href=\"/market.css\" />
<title>Market Area For$state</title>
</head>
<body>
<img id=\"mlogo\" src=\"/Artwork/marketlogo.png\">
<img id=\"menu\" src=\"/Artwork/menubackground.png\">
<table><tr><td><img src=\"$image\"></td><td>$title</td></tr>
<tr><td>$message</td></tr></table></html>
";}
if ($_GET["act"]!="view"){
if (!isset($_GET["state"])) {
echo"<html>
<head>
<link rel=\"stylesheet\" type=\"text/css\" href=\"/market.css\" />
<title>Market Area</title>
</head>
<body>
<img id=\"mlogo\" src=\"/Artwork/marketlogo.png\">
<img id=\"menu\" src=\"/Artwork/menubackground.png\">
<form name=\"marketstate\" action=\"Market.php\" method=\"GET\">
<IMG id=\"map\" SRC=\"/Artwork/USAMAPWHITE.gif\" USEMAP=\"#USAMAPWHITE\" WIDTH=598 HEIGHT=365 BORDER=0>
<MAP NAME=\"USAMAPWHITE\">

<AREA SHAPE=POLY COORDS=\"230,35,294,38,299,57,299,79,228,79\" HREF =\"http://www.chillenvillen.com/Market.php?state=North dakota\" ALT= \"N. Dakota\">

<AREA SHAPE=POLY COORDS=\"227,80,299,80,302,120,282,116,226,116\" HREF =\"http://www.chillenvillen.com/Market.php?state=South dakota\"  ALT= \"S. Dakota\"><AREA SHAPE=POLY COORDS=\"229,35,226,87,154,81,145,86,131,69,123,21\" HREF =\"http://www.chillenvillen.com/Market.php?state=Montana\" ALT= \"Montana\">
<AREA SHAPE=POLY COORDS=\"224,89,223,143,148,136,156,83\" HREF =\"http://www.chillenvillen.com/Market.php?state=Wyoming\" ALT = \"Wyoming\">

<AREA SHAPE=POLY COORDS=\"169,141,241,147,241,197,162,191\" HREF =\"http://www.chillenvillen.com/Market.php?state=Colorado\"ALT = \"Colorado\">

<AREA SHAPE=POLY COORDS=\"112,20,121,20,132,87,152,87,149,119,94,111\" HREF =\"http://www.chillenvillen.com/Market.php?state=Idaho\" ALT = \"Idaho\">

<AREA SHAPE=POLY COORDS=\"42,10,66,7,111,18,104,57,48,51,40,36\" HREF =\"http://www.chillenvillen.com/Market.php?state=Washington\" ALT = \"Washington\">

<AREA SHAPE=POLY COORDS=\"40,42,47,54,104,60,92,111,18,94\" HREF =\"http://www.chillenvillen.com/Market.php?state=Oregon\" ALT = \"Oregon\">

<AREA SHAPE=POLY COORDS=\"57,106,120,118,101,206,49,147\" HREF =\"http://www.chillenvillen.com/Market.php?state=Navada\" ALT = \"Nevada\">

<AREA SHAPE=POLY COORDS=\"122,118,149,122,146,138,167,141,159,191,110,183\" HREF =\"http://www.chillenvillen.com/Market.php?state=Utah\" ALT =\"Utah\">

<AREA SHAPE=POLY COORDS=\"16,96,55,104,46,145,98,209,96,239,71,239,24,185\" HREF =\"http://www.chillenvillen.com/Market.php?state=California\" ALT = \"California\">

<AREA SHAPE=POLY COORDS=\"109,185,159,193,151,271,138,269,101,247,103,208\" HREF =\"http://www.chillenvillen.com/Market.php?state=Arizona\" ALT = \"Arizona\">

<AREA SHAPE=POLY COORDS=\"226,117,301,122,315,159,244,160,243,145,225,142\" HREF =\"http://www.chillenvillen.com/Market.php?state=Nebraska\" ALT = \"Nebraska\">

<AREA SHAPE=POLY COORDS=\"243,162,318,162,325,172,325,196,244,196\" HREF =\"http://www.chillenvillen.com/Market.php?state=Kansas\"ALT = \"Kansas\">

<AREA SHAPE=POLY COORDS=\"231,198,324,199,328,249,265,233,264,204,233,203\" HREF =\"http://www.chillenvillen.com/Market.php?state=Oklahoma\" ALT = \"Oklahoma\">

<AREA SHAPE=POLY COORDS=\"162,193,229,199,226,269,164,267,160,271,152,270\" HREF =\"http://www.chillenvillen.com/Market.php?state=New Mexico\" ALT = \"New Mexico\">

<AREA SHAPE=POLY COORDS=\"230,204,262,205,264,236,332,253,338,300,275,355,224,308\" HREF =\"http://www.chillenvillen.com/Market.php?state=Texas\" ALT = \"Texas\">

<AREA SHAPE=POLY COORDS=\"293,38,317,35,359,49,341,70,337,94,352,107,302,111\" HREF =\"http://www.chillenvillen.com/Market.php?state=Minnesota\" ALT = \"Minnesota\">

<AREA SHAPE=POLY COORDS=\"342,68,358,66,395,87,390,118,364,122,352,102,339,93\" HREF =\"http://www.chillenvillen.com/Market.php?state=Wisconsin\" ALT = \"Wisconsin\">

<AREA SHAPE=POLY COORDS=\"303,114,352,109,365,129,353,151,316,156\" HREF =\"http://www.chillenvillen.com/Market.php?state=Iowa\" ALT = \"Iowa\">

<AREA SHAPE=POLY COORDS=\"316,158,353,154,382,196,378,207,373,202,329,206,327,171\" HREF =\"http://www.chillenvillen.com/Market.php?state=Missouri\" ALT = \"Missouri\">

<AREA SHAPE=POLY COORDS=\"327,209,370,205,376,211,374,223,363,255,336,256,331,248\" HREF =\"http://www.chillenvillen.com/Market.php?state=Arkansas\" ALT = \"Arkansas\">

<AREA SHAPE=POLY COORDS=\"335,259,363,258,362,282,383,282,392,306,337,300,342,283\" HREF =\"http://www.chillenvillen.com/Market.php?state=Louisiana\" ALT = \"Louisiana\">

<AREA SHAPE=POLY COORDS=\"365,124,389,120,393,133,398,172,393,185,382,193,355,155\" HREF =\"http://www.chillenvillen.com/Market.php?state=Illinois\" ALT = \"Illinois\">

<AREA SHAPE=POLY COORDS=\"359,68,379,58,423,64,454,116,398,131,394,85\" HREF =\"http://www.chillenvillen.com/Market.php?state=Michigan\" ALT = \"Michigan\">

<AREA SHAPE=POLY COORDS=\"396,133,427,127,431,166,405,185,391,191,402,172\" HREF =\"http://www.chillenvillen.com/Market.php?state=Indiana\" ALT = \"Indiana\">

<AREA SHAPE=POLY COORDS=\"386,193,409,186,435,163,456,167,463,178,450,190,386,201\" HREF =\"http://www.chillenvillen.com/Market.php?state=Kentucky\" ALT = \"Kentucky\">

<AREA SHAPE=POLY COORDS=\"383,203,468,190,466,196,445,211,376,224\" HREF =\"http://www.chillenvillen.com/Market.php?state=Tennessee\" ALT = \"Tennessee\">

<AREA SHAPE=POLY COORDS=\"374,227,401,222,403,284,387,288,384,280,362,282,369,263\" HREF =\"http://www.chillenvillen.com/Market.php?state=Mississippi\" ALT = \"Mississippi\">

<AREA SHAPE=POLY COORDS=\"402,221,432,217,444,254,442,273,412,275,414,283,406,283\" HREF =\"http://www.chillenvillen.com/Market.php?state=Alabama\" ALT = \"Alabama\">

<AREA SHAPE=POLY COORDS=\"427,127,468,117,472,147,457,165,433,160\" HREF =\"http://www.chillenvillen.com/Market.php?state=Ohio\" ALT = \"Ohio\">

<AREA SHAPE=POLY COORDS=\"473,148,485,147,487,154,506,145,483,173,469,179,458,168\" HREF =\"http://www.chillenvillen.com/Market.php?state=West Virginia\" ALT = \"W. Virginia\">

<AREA SHAPE=POLY COORDS=\"484,174,502,147,528,160,533,174,453,191,464,180,483,176\" HREF =\"http://www.chillenvillen.com/Market.php?state=Virginia\" ALT = \"Virginia\">

<AREA SHAPE=POLY COORDS=\"470,189,534,176,542,188,513,218,496,206,480,206,449,212\" HREF =\"http://www.chillenvillen.com/Market.php?state=North Carolina\" ALT = \"N. Carolina\">

<AREA SHAPE=POLY COORDS=\"460,211,494,208,510,218,488,250,460,218\" HREF =\"http://www.chillenvillen.com/Market.php?state=South Carolina\"ALT = \"S. Carolina\">

<AREA SHAPE=POLY COORDS=\"433,217,457,214,487,252,483,269,477,273,445,274,445,254\" HREF =\"http://www.chillenvillen.com/Market.php?state=Georgia\" ALT = \"Georgia\">

<AREA SHAPE=POLY COORDS=\"412,277,483,272,513,322,505,342,476,307,460,283,420,285\" HREF =\"http://www.chillenvillen.com/Market.php?state=Florida\" ALT = \"Florida\">

<AREA SHAPE=POLY COORDS=\"555,19,573,12,588,46,563,69,556,47\" HREF =\"http://www.chillenvillen.com/Market.php?state=Maine\" ALT = \"Maine\">

<AREA SHAPE=POLY COORDS=\"549,50,556,48,563,69,565,83,552,85\" HREF =\"http://www.chillenvillen.com/Market.php?state=New Hampshire\" ALT = \"New Hampshire\">

<AREA SHAPE=POLY COORDS=\"537,59,549,55,549,84,545,85,541,75\" HREF =\"http://www.chillenvillen.com/Market.php?state=Vermont\" ALT = \"Vermont\">

<AREA SHAPE=POLY COORDS=\"474,106,534,57,546,107,544,112,531,109,528,102,478,112\" HREF =\"http://www.chillenvillen.com/Market.php?state=New York\" ALT = \"New York\">

<AREA SHAPE=POLY COORDS=\"469,116,474,109,478,115,527,105,533,125,526,134,477,146\" HREF =\"http://www.chillenvillen.com/Market.php?state=Pennsylvania\" ALT = \"Pennsylvania\">

<AREA SHAPE=POLY COORDS=\"544,87,565,85,576,85,576,94,566,91,547,96\" HREF =\"http://www.chillenvillen.com/Market.php?state=Massachusetts\" ALT = \"Massachusetts\">

<AREA SHAPE=POLY COORDS=\"560,94,565,92,569,96,563,100\" HREF =\"http://www.chillenvillen.com/Market.php?state=Rhode Island\" ALT = \"Rhode Island\">

<AREA SHAPE=POLY COORDS=\"546,97,560,94,562,101,548,105\" HREF =\"http://www.chillenvillen.com/Market.php?state=Connecticut\" ALT = \"Connecticut\">

<AREA SHAPE=POLY COORDS=\"532,111,545,113,544,120,542,142,529,135,535,124,530,117\" HREF =\"http://www.chillenvillen.com/Market.php?state=New Jersey\" ALT = \"New Jersey\">

<AREA SHAPE=POLY COORDS=\"531,139,540,153,534,153\" HREF =\"http://www.chillenvillen.com/Market.php?state=Delaware\" ALT = \"Delaware\">

<AREA SHAPE=POLY COORDS=\"486,146,529,136,536,155,536,161,515,156,511,144\" HREF =\"http://www.chillenvillen.com/Market.php?state=Maryland\" ALT = \"Maryland\">

</MAP>
</form>
</body>
</html>";}
if (isset($_GET["state"])) {
$state=$_GET["state"];
$_SESSION["state"]=$state;
$user = "root"; 
$pass = "cooldude1"; 
$db = "Market";
$host="localhost";
mysql_connect($host,$user,$pass) or die("ERROR:".mysql_error());
mysql_select_db($db) or die("ERROR DB:".mysql_error()); 
$sql = mysql_query("SELECT * FROM postings WHERE state = '$state'");
$result=mysql_fetch_array($sql);
echo"<html>
<head>
<link rel=\"stylesheet\" type=\"text/css\" href=\"/market.css\" />
<title>Market Area For$state</title>
</head>
<body>
<img id=\"mlogo\" src=\"/Artwork/marketlogo.png\">
<img id=\"menu\" src=\"/Artwork/menubackground.png\">
";
$max = 1; //amount of articles per page. change to what to want
$p = $_GET['page'];
if(empty($p))

{

$p = 1;

}
$limits = ($p - 1) * $max; 

//view the news article!
if(isset($_GET['act']) && $_GET['act'] == "view")

{
$id = $_GET['id'];

$sql = mysql_query("SELECT * FROM postings WHERE state = '$state'");

while($r = mysql_fetch_array($sql))

{

$itemimage = $r['item_image'];

$message = $r['message'];

$state_name = $r['state'];

echo "<p>$itemimage</p><p>$message</p><p>$state_name</p>";

}



}else{



//view all the news articles in rows

$sql = mysql_query("SELECT * FROM postings  WHERE state ='$state'LIMIT ".$limits.",$max ") or die(mysql_error());

//the total rows in the table

$totalres = mysql_result(mysql_query("SELECT COUNT(id) AS tot FROM postings"),0);	

//the total number of pages (calculated result), math stuff...

$totalpages = ceil($totalres / $max); 

//the table

echo "<table><tr><td>$state</td></tr><tr>";

while($r = mysql_fetch_array($sql))

{

$id = $r['id'];

$item_image = $r['item_image'];

$item_title = $r['Item_type'];

echo "<td><a href='Market.php?act=view&id=$id'><img src=\"$item_image\">$item_title</a>";

}

//close up the table

echo "</tr></table>";

for($i = 1; $i <= $totalpages; $i++){ 

//this is the pagination link

echo "<a href='Market.php?page=$i'>$i</a>|";

}

}

echo"</body></html>";}}
//}
?>


you can take a look at what is shows on here: Click here to see the web page of script given.

on that page you will see a U.S MAP click michigan and you should see links below a a image and the word car that would show 1 and 2 these are the pages.Once the page links are clicked it would load back the image map which is not what I wanted I want to show whats on that page so page one would have whatever that was generated first from the database and the second would be the second generated page from database. I don't want it to load back the image map of the U.S .

What should I do I know the code is messy and hard to read. I tried to make classes to help out but made things worse.

if someone can tell me how to clean up my code to make things simple without repeating alot of code please do tell.

I want to really start using classes to speed up my project. So is there a better way of doing a pagenation .

Now I also would like to know if I were to get employed to a company what do they expect from php programmers.

I was thinking to get php certified to get a job but I am still kinda afraid that I may not know enough to do the job.

Like would they expect you to know high level math to create new algorithms??

and which is the best certification and how can I study for it.

I was thinking to use expertrating.com I already did got tested with there html 4.1 and computer technician certification I tried getting employed at geek squad but no calls so I was thinking the certificate has no value.

any help I would love to get employed at some point into programming area. I am currently in college going for accounting. I wanted to go for computer science but my dad talked to me and told me he knew alot of people that were programmers and he said every 3 years they would get a new programmer so he just told me that your skills is not that value in that field you can get easily replaced by new comers from college.

thanks for your time.

Mod Edit: Font size changed, there's no need to post in that large of a font :)

This post has been edited by PsychoCoder: 26 September 2008 - 12:37 PM


Is This A Good Question/Topic? 0
  • +

Replies To: I need some help with paging....

#2 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3100
  • View blog
  • Posts: 10,888
  • Joined: 08-August 08

Re: I need some help with paging....

Posted 25 September 2008 - 10:26 AM

First, take a deep breath. Next, read what you've written. Not the code, but your questions. Do you see that it's basically a series of run-on sentences? You don't even use question marks! I've read it several times, and I've barely begun to decipher what it is that you're asking about.

If you want to write better code, start by writing better sentences, questions, and paragraphs. That will help you to organize your thoughts, allowing you to write code that isn't "messy and hard to read." It will also make it easier for others to help.
Was This Post Helpful? 0
  • +
  • -

#3 hockey97  Icon User is offline

  • D.I.C Regular

Reputation: -77
  • View blog
  • Posts: 300
  • Joined: 25-September 08

Re: I need some help with paging....

Posted 25 September 2008 - 12:07 PM

My question is how can I make a pagnation script in php???

I already created my script in php, which has a image map . Also when the value is passed from the image map which is the name of the state. My code would then do a database lookup for any data that is stored for that state. Then once I get that data I would then generate pages and limit how many to display. It should look like a table with an image and names in each row which at the end of the table would be links to pages like page 1, page2, page3...ect.. I am able to generate the page links and the data but I am not able to like each page and display it.

This post has been edited by hockey97: 25 September 2008 - 12:18 PM

Was This Post Helpful? 0
  • +
  • -

#4 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3100
  • View blog
  • Posts: 10,888
  • Joined: 08-August 08

Re: I need some help with paging....

Posted 25 September 2008 - 12:33 PM

What are the values for $image and $title?
Have it echo them outside the table as well as try to display them in it.

This post has been edited by CTphpnwb: 25 September 2008 - 12:46 PM

Was This Post Helpful? 0
  • +
  • -

#5 pr4y  Icon User is offline

  • Location: 127.0.0.1
  • member icon

Reputation: 35
  • View blog
  • Posts: 621
  • Joined: 19-September 08

Re: I need some help with paging....

Posted 25 September 2008 - 12:41 PM

looks like you already got a bit of help with the code, but as far as the certification goes:

a PHP certification will doubtfully get you a job in the field. the most you could hope for is an entry level position as a small web apps developer, but even in that case you would NEED a portfolio of personally accomplished projects to even be considered for the job.

trust me, there is a LOT of competition in the programming field, and a company will 99 times out of 100 hire the person with a bachelors degree over the person with no degree and a good portfolio...

then again, my statements aren't fact, they are speculation... i'm just trying to get the point across that there is so many available workers that are talented at PHP... without a degree you will have a hard time finding a job without VERY GOOD demonstrated abilities.
Was This Post Helpful? 0
  • +
  • -

#6 William_Wilson  Icon User is offline

  • lost in compilation
  • member icon

Reputation: 205
  • View blog
  • Posts: 4,807
  • Joined: 23-December 05

Re: I need some help with paging....

Posted 25 September 2008 - 12:43 PM

You asked "how to clean up my code", so if I may offer some advice as well as a request.

<rant>
I don't care how you code for personal use, I'll never see the code, but if you plan on posting more than a few lines anywhere and want anyone to look at AND understand your code indenting is a must.

While you are consistent in using 0 indents, looking at the line after line of unstructured code, makes me want to scratch my eyes out.

To be honest, when i read code like this, once I reach the 2nd or 3rd conditional or loop (let alone embedded ones), I stop reading, it is impossible to tell how the code works with a reasonable amount of effort.
</rant>
Was This Post Helpful? 0
  • +
  • -

#7 pr4y  Icon User is offline

  • Location: 127.0.0.1
  • member icon

Reputation: 35
  • View blog
  • Posts: 621
  • Joined: 19-September 08

Re: I need some help with paging....

Posted 25 September 2008 - 12:48 PM

also i just noticed after a quick glance at your code you have declared the MySQL database connection information twice.

maybe a good start for you if you are a beginning programmer would be to mock up some pseudo code for what you are trying to do. programming is like a big math problem, but doesn't need to be looked upon as the most difficult thing in the world. draw up some diagrams of exactly what you want done, and how each function will work.

like CTphpnwb said, just take a breather and look at what you are doing... it will come to you, but to be honest I can't even understand what it is you are trying to, or what needs to be fixed. I see a bit of broken code, but i have NO CLUE exactly what you need done. try explaining yourself a bit better.
Was This Post Helpful? 0
  • +
  • -

#8 Moonbat  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 36
  • View blog
  • Posts: 424
  • Joined: 30-June 08

Re: I need some help with paging....

Posted 25 September 2008 - 12:54 PM

Pagination just requires you to check what 'page' you are on in the PHP script, and then displaying the appropriate records. For example, if you have 100 names and you want to show 10 per page, the query for 'page' 1 would be:

SELECT Names FROM table LIMIT 0, 10


When you use LIMIT, you specifiy two parameters. The first one (0) says what record to start from. (0) indicates you are starting from the beginning. The second parameter (10) shows how many records you want to display starting from the first parameter (0).

Then, for 'page' 2, you would use this query:
SELECT Names FROM table LIMIT 10, 10


For a more in-depth tutorial, check out BetaWar's Pagination Tutorial on DIC
Was This Post Helpful? 0
  • +
  • -

#9 hockey97  Icon User is offline

  • D.I.C Regular

Reputation: -77
  • View blog
  • Posts: 300
  • Joined: 25-September 08

Re: I need some help with paging....

Posted 25 September 2008 - 01:32 PM

Thanks for the help. Also is there any good class tutorials??? The reason I plan to start using object oriented programming.. to help clean out my code and to prevent repeats.

Here is what the script is supposed to do:

The php script is made for a market listing like ebay or cregs list. So when a person clicks the image map of the U.S on the state they want to see a list of items being sold.

The image map the once clicked would send a value back to the php script using the GET method. then my php script would then take off the image map and load in a table with items being sold for that sate this would be data from a mysql database.

So I wanted to make a table display items being sold with a max of 20 for each page. So when I have more then 20 itmes I want it to create a 2nd page without having me to create many html or php files.

I am no beginner to php , nor a expert at php.

I am creating a website and currently never made a paging system.

Thanks for the help I will take a look at that tutorial. I would also like a class or object programming tutorial for php to help speed things up a bit.
Was This Post Helpful? 0
  • +
  • -

#10 Moonbat  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 36
  • View blog
  • Posts: 424
  • Joined: 30-June 08

Re: I need some help with paging....

Posted 25 September 2008 - 02:01 PM

I wrote two good tutorials on OOP. Check them out:

Moonbat's OOP in PHP Guide Part 1

Moonbat's OOP in PHP Guide Part 2
Was This Post Helpful? 0
  • +
  • -

#11 hockey97  Icon User is offline

  • D.I.C Regular

Reputation: -77
  • View blog
  • Posts: 300
  • Joined: 25-September 08

Re: I need some help with paging....

Posted 26 September 2008 - 12:32 PM

ok this question is for moonbat.

I am using that
SELECT Names FROM table LIMIT 0, 10
code.
but I kinda modded it don't know if I can really do this or not but I am not getting any error messages.

I have this currently
"SELECT * FROM table WHERE state=$state LIMIT 0, 10"


do you think that this code should still work???

I need to grab only the data that is for that one state.

This post has been edited by hockey97: 26 September 2008 - 03:31 PM

Was This Post Helpful? 0
  • +
  • -

#12 Moonbat  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 36
  • View blog
  • Posts: 424
  • Joined: 30-June 08

Re: I need some help with paging....

Posted 26 September 2008 - 12:49 PM

View Posthockey97, on 26 Sep, 2008 - 12:32 PM, said:

I have this currently
"SELECT * FROM table LIMIT 0, 10 WHERE state=$state"


do you think that this code should still work???

I need to grab only the data that is for that one state.

That's almost right. The correct syntax is:
SELECT * FROM table WHERE state='$state' LIMIT 0, 10

Was This Post Helpful? 0
  • +
  • -

#13 hockey97  Icon User is offline

  • D.I.C Regular

Reputation: -77
  • View blog
  • Posts: 300
  • Joined: 25-September 08

Re: I need some help with paging....

Posted 26 September 2008 - 01:03 PM

View PostMoonbat, on 26 Sep, 2008 - 12:49 PM, said:

View Posthockey97, on 26 Sep, 2008 - 12:32 PM, said:

I have this currently
"SELECT * FROM table LIMIT 0, 10 WHERE state=$state"


do you think that this code should still work???

I need to grab only the data that is for that one state.

That's almost right. The correct syntax is:
SELECT * FROM table WHERE state='$state' LIMIT 0, 10



Thanks ... ok I mistyped it on here but I got what you had. This was because I got error messages with what I just posted and then tried putting the limit in the back which I didn't have any errors and wounder if the limit does run which I done a test right now and it does run.

I just wanted to second check that I am doing it right. Thanks.
Was This Post Helpful? 0
  • +
  • -

#14 hockey97  Icon User is offline

  • D.I.C Regular

Reputation: -77
  • View blog
  • Posts: 300
  • Joined: 25-September 08

Re: I need some help with paging....

Posted 26 October 2008 - 11:01 AM

I just wanted to thank all the replies.

thank you guys!!!..:)

This post has been edited by hockey97: 26 October 2008 - 11:05 AM

Was This Post Helpful? 0
  • +
  • -

#15 hockey97  Icon User is offline

  • D.I.C Regular

Reputation: -77
  • View blog
  • Posts: 300
  • Joined: 25-September 08

Re: I need some help with paging....

Posted 01 September 2009 - 09:47 PM

BLURB!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :angry: :rolleyes: :v: :pirate:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1