Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.