Results 1 to 5 of 5

Thread: Move to next MySQL record

  1. #1

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Move to next MySQL record

    Is there a way to move to the next record where stated in the PHP code?

    PHP Code:
    while ($myrow mysql_fetch_row($result)) {

    echo(
    "line 1");

    // Move to next record

    echo("line 2");


    Thanks, ILMV

  2. #2
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: Move to next MySQL record

    When you call mysql_fetch_row it autmatcially moves to the next record. Are you trying to do something specific.

  3. #3

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: Move to next MySQL record

    Yes i am loading pictures using a link in a MySQL database, the pictures are two to a row, so i need to bring the first down, then move a record and bring the second donwn.

    If there isnt a way around it i will have to do it the hard way.

    thanks :thup:

  4. #4
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: Move to next MySQL record

    Your putting the images in a table right?

    Try
    PHP Code:
    <table>
        <tr>
    <?
    $i = 1;
    while ($myrow = mysql_fetch_row($result))
    {
        print "<td>{$myrow['value']}</td>"
        
        if(($i % 2)==0)
        {
            print "</tr><tr>";
        }
        $i++
    }
    ?>
        </tr>
    </table>

  5. #5

    Thread Starter
    Frenzied Member I_Love_My_Vans's Avatar
    Join Date
    Jan 2005
    Location
    In the PHP compiler
    Posts
    1,275

    Re: Move to next MySQL record

    That was plan B

    Thanks for your help (Y)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width