|
Posted by Jeff North on 09/28/56 11:20
On Sun, 03 Jul 2005 13:29:16 GMT, in alt.php "Mike"
<ampeloso@verizon.net> wrote:
>| Hello,
>| I don't want anyone to write this for me.I just need a nudge.
>| I have a Db with links to images that I want to display in a table 5 columns
>| wide.I already created the code to add one row to the $NumRecords/5.
>| I need to put the records in the table without going back to the beginning
>| of the recordset.
>| Getting my conditionals and loops in the right order is the problem.
>| Any help would be appreciated
>| Thanks,
>| Mike
>|
Do you want to have
1. 5 columns with multiple rows
2. just 5 columns and navigate to the next set of 5.
1. You will need to read in the entire recordset and use program logic
to split the results into rows
read recordset
set counter to 0
loop until no more data
if counter mod 5 == 0
start a new row
display image
increment counter
end loop
2. look at the LIMIT statement with mysql select statement.
You would have something like:
sql = "SELECT * FROM imageTable LIMIT ".$StartNum.",".StartNum+5;
Your Next/Previous buttons on the page would be coded as:
<a href="images.php?Pg=<?php echo $PrevPg?>">Previous</a>
<a href="images.php?Pg=<?php echo $NextPg?>">Next</a>
Your code would get the value passed on the url
$PgNum = $_GET["Pg"];
$StartNum = $PgNum * 5;
$PrevPg = $PgNum--;
$NextPg = $PgNum++;
HTH
---------------------------------------------------------------
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Navigation:
[Reply to this message]
|