Jump to content

Recommended Posts

I may of been looking at this for to long, but I have got 10 records in a database, all with the same album id. BUT it will only display 5 of them.... Why!

 

$gal = mysql_query("SELECT * FROM albums WHERE profilename = '$DisplayProfile'");
	while($albums = mysql_fetch_assoc($gal)){
	//generate information for albums

	$albumid = $albums["ID"];  //ID
	$albumname = $albums["albumname"];  //name
	$albumshot = $profile["profilename"]; //profilename

	$galimage = mysql_query("SELECT * FROM content WHERE albumid = ".$albumid." AND AdminAuth = 'true'"); 

	//display generated information for albums

	echo "<h3>".$albumname."</h3>";
	while($albumphotos = mysql_fetch_assoc($galimage)){
		$albumimage = $albumphotos["contenturl"]; //content location
		echo "<img src='content/" . $albumshot . "/" . $albumimage . "/>";
		}

	}

 

Looking at the MySQL database it looks like it is skipping alternate records...I am baffled..... Please help

I'm confused as to why you have a second while?

<?php
$gal = mysql_query("SELECT * FROM albums WHERE profilename = '$DisplayProfile'");
while($albums = mysql_fetch_assoc($gal)){
//generate information for albums
$albumid = $albums["ID"];  //ID
$albumname = $albums["albumname"];  //name
$albumshot = $profile["profilename"]; //profilename
$galimage = mysql_query("SELECT * FROM content WHERE albumid = ".$albumid." AND AdminAuth = 'true'"); 
//display generated information for albums
echo "<h3>".$albumname."</h3>";
$albumphotos = mysql_fetch_assoc($galimage);
$albumimage = $albumphotos["contenturl"]; //content location
echo "<img src='content/" . $albumshot . "/" . $albumimage . "/>";
}
?>

 

Like I say, you don't need it.. so you might aswell stick with that.

The first while...

while($albums = mysql_fetch_assoc($gal)){

lists and loops all albums, and the second while...

while($albumphotos = mysql_fetch_assoc($galimage)){

lists all the photos in the album.

 

But i tryed just listing all the photos and removed the albums, but it would still only display 5 out of 10 photos skipping alternate records.

Stunned....

while($albumphotos = mysql_fetch_assoc($galimage)){
		$albumimage = $albumphotos["contenturl"]; //content location
		echo $albumimage;
		}

 

worked, it displays all records but why not.

 

	

while($albumphotos = mysql_fetch_assoc($galimage)){
$albumimage = $albumphotos["contenturl"]; //content location
echo "<img src='content/" . $albumshot . "/" . $albumimage . "/>";

}

i knew id been looking at it to long and totally missed a single '

 

while($albumphotos = mysql_fetch_assoc($galimage)){
$albumimage = $albumphotos["contenturl"]; //content location
echo "<img src='content/" . $albumshot . "/" . $albumimage . "/>";

}

 

<img src='content/" . $albumshot . "/" . $albumimage . "'/>

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.