Jump to content

ins-coder

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ins-coder's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. You can check the code at the website with out any change other than connectivity and table names etc. Basically current displaying image shows "its actual id+1" like if an image has an id of 5, there it will have 6 so second last is having id of the last one, so its skipping. Any one please check it.
  2. [b]MySQL[/b] +----+ | id | +----+ | 1 | +----+ | 2 | +----+ | 3 | +----+ | 4 | +----+ +----+ | 5 | +----+ How do I show records from a specific ID so the list would show 2,3,4,5 or 3,4,5? I figured to do with two queries in UNION but end up showing 2,1,3,4,5 or 2,5,4,3,1.
  3. Thanks, here is my code <?PHP session_start(); include ('includes/db.php'); /* MODIFY TO FIT YOUR CONNECTION INFO */ $query = "SELECT * FROM vote_frames WHERE pshow='1'"; /* MODIFY TO REFLECT YOUR DATABASE TABLE */ $result = mysql_query($query); while($row = mysql_fetch_array($result)){ $image_array[] = $row['frame_pic']; /* MODIFY TO REFLECT YOUR FIELD NAME */ $image_array1[] = $row['frame_pic1']; /* MODIFY TO REFLECT YOUR FIELD NAME */ $image_array2[] = $row['frame_pic2']; /* MODIFY TO REFLECT YOUR FIELD NAME */ } $num_images_to_display = 1; /* MODIFY TO REFLECT NUMBER OF IMAGES TO SHOW PER SCREEN */ $num_images = count($image_array); $image_path = "../frame_images/"; /* MODIFY TO REFLECT THE PATH TO YOUR IMAGES */ $y = $num_images_to_display; if(!isset($_GET['first'])){ $first = 0; }else{ $first = (int) $_GET['first']; } $x = $num_images - 1; $z = $x - $y; if($first>$z) { $first = $z; } $last = $first + $num_images_to_display; ?> <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> </head> <body bgcolor="#ffffff" text="#000000" link="#000000" vlink="#000000" alink="#000000"> <div style="position:absolute; top:50px; left:100px; width:800px; text-align: center;"> <?PHP $i = $first; while($i<$last) { $showme = $image_path . $image_array[$i]; $showme1 = $image_path . $image_array1[$i]; $showme2 = $image_path . $image_array2[$i]; ?> <img src="<?PHP echo $showme; ?>" width="176px" height="197px"> <?php if($image_array1[$i]!="") { ?><img src="<?PHP echo $showme1; ?>" width="176px" height="197px"><?php } else { ?><img src="../image/no_image.jpg" width="176px" height="197px"><?PHP } ?> <?php if($image_array2[$i]!="") { ?><img src="<?PHP echo $showme2; ?>" width="176px" height="197px"><?php } else { ?><img src="../image/no_image.jpg" width="176px" height="197px"><?PHP } $i++; } $prev = $first-1; $next = $first +1; if($prev<0){ $prev = 0; } ?> </div> <div style="position:absolute; top:10px; left:100px; width:800px;"> <center><a href="imgal.php?first=<?PHP echo $prev; ?>">Previous</a> - <a href="imgal.php?first=<?PHP echo $next; ?>">Next</a></center> </div> </body> </html> Although I am showing three images because the other two are sub images of the same record, but I have tried using only one and it does the same thing as well.
  4. Thanks for this but when I use this, it does not show the last and shows second last record two times. I have not change any thing in the loop, just changed line according to the comments. i.e db file, query etc please help or suggest any thing better than for this same procedure.
×
×
  • 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.