Jump to content

Split Page


DreamOn

Recommended Posts

Hi All,

 

New here and i need some help with this...

 

I am designing a website which will list names depening on which letter you select from the list...

 

for this example, ill use letter S.

 

below is the code i have

 

function myS(){

if (isset($_GET["page"])) { $page  = $_GET["page"]; } else { $page=1; }; 
$start_from = ($page-1) * 1; 
$result = @mysql_query("SELECT idinfo, fldName FROM info WHERE fldName LIKE 's%' ORDER BY fldName LIMIT $start_from, 1"); 

while ($row = mysql_fetch_assoc($result)) { 
echo ("<p>" . $row["fldName"] . "</p>");
}
$rs_result = @mysql_query("SELECT Count(idinfo) from info WHERE fldName LIKE 's%'");
$row1 = mysql_fetch_row($rs_result); 
$total_records = $row1[0]; 
$total_pages = ceil($total_records / 1); 

for ($i=1; $i<=$total_pages; $i++) { 
            echo "<a href='index.html?run=s&page=".$i."'>".$i."</a> "; 
}


}

 

i have it so it shows one record per page, and when i click the next page i want it to show the next record for that page, but its not working and i think its something to do with this part of the coding:

 

            echo "<a href='index.html?run=s&page=".$i."'>".$i."</a> "; 

 

for testing purposes i am only showing 1 record per page, once i have it fully working, i will list around 5-10, but i know how to get that changed, just cant get this page change to work.

 

Any help with this will be great.

 

-DreamOn

 

P.S - sorry if its in the wrong section, could a mod move it if so.

Link to comment
https://forums.phpfreaks.com/topic/229178-split-page/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.