I TRIED TO CREATE A SIMPLE WEB ALBUM,SO THAT SOMEONE WILL BE ABLE TO UPLOAD HIS PHOTOS.UPLOADING WAS NOT A PROBLEM.
THE PROBLEM IS WHEN I`M DISPLAYING THEM,BCOZ FOR EXAMPLE IF ONE MEMBER HAS 9 PICTURES THEN ONLY ONE PICTURE, I`M MEAN THE FIRST PICTURE TO BE UPLOADED WITH MEMBER IS BEEN DISPLAYED 9 TIMES.
SO I DONT KNOW WHERE I`M WRONG,I WANT ALL 9 PICTURES TO BE DISPLAYED.
AND NOT ONE 9 TIMES.
BELOW IS THE CODE I USED
FOR DISPLAYING.

<?php

$user=$_SESSION['user'];
$userid=$_GET['userid'];
   
				include"config.php";
				$index="SELECT id,image FROM  myphoto WHERE userid ='$userid' and user='$user'";
				 $member=mysql_query($index);
				 $counter=0;
				 while($row=mysql_fetch_array($member)){
				    
				    $id=$row['id'];
				       //$name=$row['name'];
					     $user=$row['user'];
						   //$family=$row['family'];
						     //$country=$row['country'];
				
				if($counter==3) {
				echo "<br />"; 
				// reset the counter$counter = 0;
				$counter = 0;
				
				}
				
				 ?>
	 
	 
	 
				<?php
				  echo"<a href= mypictures.php?id=$userid ><img src=picretrieve.php?userid=$userid width=120 height=120 border=0 alt='$id''>";
				
				  ?>
				  
			
				 
				 
			<?php	 
				  $counter++;
				}
				
				
				
				?>

try

$index="SELECT id,image FROM myphoto WHERE userid ='$userid' and user='$user'"; $member=mysql_query($index); $total= mysql_num_rows($member);

for($i=0;$i<$total;$i++) { $row = mysql_fetch_array($member); $userid = $row['userid']; $id = $row['id']; echo"<a href= mypictures.php?id=$userid ><img src=picretrieve.php?userid=$userid width=120 height=120 border=0 alt='$id''>"; }[code=php]
$index="SELECT id,image FROM myphoto WHERE userid ='$userid' and user='$user'";
$member=mysql_query($index);
$total= mysql_num_rows($member);

for($i=0;$i<$total;$i++) {
$row = mysql_fetch_array($member);
$userid = $row;
$id = $row;
echo"<a href= mypictures.php?id=$userid ><img src=picretrieve.php?userid=$userid width=120 height=120 border=0 alt='$id''>";
}

IT IS DOING JUST THE SAME THING,ONLY THAT IT SHOWS IN ONE ROW.
MY CODE IS SHOWING THREE IMAGES IN EACH ROW.
Below is the picretrieve .php
may be it can help to see my mistake.
picretrieve.php

<?php
//PHP code (for images.php)

if(isset($_GET['userid'])){
$userid=$_GET['userid'];


//database connection routine
// Connecting to a MySql Database
mysql_connect("localhost", "root", "650715") or die(mysql_error());
          mysql_select_db("register");

$query = "SELECT * FROM myphoto WHERE userid ='$userid'";
$result = mysql_query($query);
$count=mysql_num_rows($result);
if($count){
while($row = mysql_fetch_array($result)){
  $id=$row['id'];
  $image = $row['image'];
  $filetype = $row['filetype'];
  
header("Content-type: ". $filetype);
echo $image;

}


}
}else{
echo"ID for image was not found";
}
?>

if you want to show 3 in each row:

$index="SELECT id,image FROM myphoto WHERE userid ='$userid' and user='$user'";
$member=mysql_query($index);
$total= mysql_num_rows($member);
$count = 0;
for($i=0;$i<$total;$i++) {
$row = mysql_fetch_array($member);
$userid = $row['userid'];
$id = $row['id'];
if($count%3==2)
    echo "<br />";
echo"<a href= mypictures.php?id=$userid ><img src=picretrieve.php?userid=$userid width=120 height=120 border=0 alt='$id''>";

}

Thankx)))but it is still showing one picture in number of times.i mean three picture same picture in each row.
I want different pictures thats why i posted the picretrieve.php .

Any one to check my code please!!!!??

hello mrcniceguy ..
i have checked your code...
i think you just end your if condition brace at that line only...
means like..

if(isset($_GET['userid']))
{
$userid=$_GET['userid'];
}

other wise it will take that userid again and it will fetch and it will display first image...
try this way..you will definatly get your requirement..

i realised the problem that i were not sending the id of each image to picretrieve.php.
Thankx you for contributions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.