Jump to content

multiple pictures


angelsRock

Recommended Posts

i got error on the if part in mysql query..!! :'(

 

<?php
if(is_uploaded_file($_FILES[image1][tmp_name]))
						{			
								$imagename1 = basename($_FILES['image1']['name']);						
								$newimage1 = "art/" . $imagename1;
								$thumbimage="thumbs/" . $imagename;
								echo $_FILES['image1']['type'];
								if(move_uploaded_file($_FILES[image1][tmp_name],$newimage1))
								{						
								echo"<p class=good>FIRST PICTURE UPLOADED OK</p>";		
								}
								else
								{
								echo"<p class=error>PICTURE ERROR</p>";
								}					
						}







	mysql_select_db($db);		
	$query = "update premium_propertyad set address='".$_POST[address]."', area='".$_POST[area]."', state='".$_POST[state]."', type1='".$_POST[type1]."', type2='".$_POST[type2]."', type3='".$_POST[type3]."', selling_price='".$_POST[selling_price]."', rental_price='".$_POST[rental_price]."', land_area='".$_POST[land_area]."', buildup_area='".$_POST[buildup_area]."', tenure='".$_POST[tenure]."', bedroom_num='".$_POST[bedroom_num]."', bathroom_num='".$_POST[bathroom_num]."', remarks='".$_POST[remarks]."',"

	if($_FILES['image1']['name']>0 || $_FILES['image2']['name']>0|| $_FILES['image3']['name']>0)
	{
		$query = $query & "photo1='$imagename1',photo1='$imagename1',photo1='$imagename1',"
	}

	$query= $query& " facilities='$facilities' where username='".$_SESSION[username]."' and premPropertyID='".$_POST[basic_id]."' ";			

		echo $query;
		echo mysql_error();
		$result=mysql_query($query);?>

 

i want to update the page.. if the picture are not change.. so it will just update the record .. where the previous picture willl be remained...

Link to comment
https://forums.phpfreaks.com/topic/73188-multiple-pictures/
Share on other sites

ohh.. the above page is the edit page..  the user descriptions and pictures will be shown..

 

if user want to update the data but not the picture .. mean the

<input type="file" size=50 name="image1"> will be left blank..

 

if i update the blank value.. it will overwrite the previous picture..  so i put the above code like that .. but it prompt me error on the

 

<?php
if($_FILES['image1']['name']>0 || $_FILES['image2']['name']>0|| $_FILES['image3']['name']>0)
	{
		$query = $query & "photo1='$imagename1',photo1='$imagename1',photo1='$imagename1',"
	}?>

Link to comment
https://forums.phpfreaks.com/topic/73188-multiple-pictures/#findComment-369199
Share on other sites

<?php
if(is_uploaded_file($_FILES[image1][tmp_name]))
						{			
								$imagename1 = basename($_FILES['image1']['name']);						
								$newimage1 = "art/" . $imagename1;
								$thumbimage="thumbs/" . $imagename;
								echo $_FILES['image1']['type'];
								if(move_uploaded_file($_FILES[image1][tmp_name],$newimage1))
								{						
								echo"<p class=good>FIRST PICTURE UPLOADED OK</p>";		
								}
								else
								{
								echo"<p class=error>PICTURE ERROR</p>";
								}					
						}







	mysql_select_db($db);		
	$query = "update premium_propertyad set address='".$_POST[address]."', area='".$_POST[area]."', state='".$_POST[state]."', type1='".$_POST[type1]."', type2='".$_POST[type2]."', type3='".$_POST[type3]."', selling_price='".$_POST[selling_price]."', rental_price='".$_POST[rental_price]."', land_area='".$_POST[land_area]."', buildup_area='".$_POST[buildup_area]."', tenure='".$_POST[tenure]."', bedroom_num='".$_POST[bedroom_num]."', bathroom_num='".$_POST[bathroom_num]."', remarks='".$_POST[remarks]."',"

	if($_FILES['image1']['name']>0 || $_FILES['image2']['name']>0|| $_FILES['image3']['name']>0)
	{
		$query = $query & "photo1='$imagename1',photo1='$imagename1',photo1='$imagename1',"
	}

	$query= $query& " facilities='$facilities' where username='".$_SESSION[username]."' and premPropertyID='".$_POST[basic_id]."' ";			

		echo $query;
		echo mysql_error();
		$result=mysql_query($query);?>

if your not passing a file then why check for the file ?

 

sorry... i don get what u meant..

i do everything in a page..

 

if($_FILES['image1']['name']>0 || $_FILES['image2']['name']>0|| $_FILES['image3']['name']>0)

the above is to check whether any picture exist in the <input type=file>

 

 

my idea is to check out of that 3 <input type=file> , if one got value.. then it will  update the

 

$query = $query & "photo1='$imagename1',photo1='$imagename1',photo1='$imagename1',"

thanks for hlep

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/73188-multiple-pictures/#findComment-369212
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.