SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Non-Member
    Join Date
    Jun 2007
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Severn Priority Images

    Hiya Guys (and Girls),

    I am currently using the following code to display images from server, how do I load the first 7 images, first, then load everything else after?

    Code PHP:
    <link rel="stylesheet" type="text/css" href="Index.css" />
     
    <?php
    $con = mysql_connect("localhost","peter","abc123");
    if (!$con)
    {
      die('Could not connect: ' . mysql_error());
    }
     
    mysql_select_db("Gallery", $con);
     
    $result = mysql_query("SELECT * FROM Images");
     
    while($row = mysql_fetch_array($result))
    {
      echo '<img src="' . $row['Path'] . '" />';
      echo $row['Caption'];
    }
     
    mysql_close($con);
    ?>

  2. #2
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Do you mean you want to add some kind of separator after first 7 images? Then,

    Code php:
    <link rel="stylesheet" type="text/css" href="Index.css" />
     
    <?php
    $con = mysql_connect("localhost","peter","abc123");
    if (!$con)
    {
      die('Could not connect: ' . mysql_error());
    }
     
    mysql_select_db("Gallery", $con);
     
    $result = mysql_query("SELECT * FROM Images");
     
    $i=0;
    while($row = mysql_fetch_array($result))
    {
      echo '<img src="' . $row['Path'] . '" />';
      echo $row['Caption'];
      if(++$i==7)echo '<hr/>';
    }
     
    mysql_close($con);
    ?>
    Saul


Bookmarks

Posting Permissions

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