hemi
09-09-2009, 09:53 AM
my problem is the following code is not editing my image
-------------------------------------------------------------------------------------------------
if($_REQUEST['id'])
{
if($file=="")
{
$vars='uploads/';
$file=$vars.basename($_FILES['images']['name']);
move_uploaded_file($_FILES['images']['tmp_name'],$file);
}
$result=mysql_query("select * from category where id=$_REQUEST[id]");
if($result)
if(mysql_num_rows($result))
extract(mysql_fetch_assoc($result),EXTR_PREFIX_ALL ,'msg');
if($images=="")
{
$file=$msg_images;
}
$vars='uploads/';
$result=mysql_query("select * from category where id='$_REQUEST[id]'");
if($result)
if(mysql_num_rows($result))
$var=mysql_fetch_array($result);
if(isset($_POST['submit']))
{
$title=$_POST['title'];
$rupees=$_POST['rupees'];
$location=$_POST['location'];
$description=$_POST['description'];
$email=$_POST['email'];
//echo"update category set title='$title',rupees='$rupees',images='$file',loc ation='$location',email='$email',description='$des cription' where id={$_REQUEST['id']}";
$result=mysql_query("update category set title='$title',rupees='$rupees',location='$locatio n',email='$email',description='$description' where id={$_REQUEST['id']}");
if($result)
{
//echo"SELECT id FROM category where email='$email'& title='$title'& rupees='$rupees' & location='$location' & desrciption='$description'";
$res=mysql_query("SELECT id FROM category where id=$_REQUEST[id]");
$var=mysql_fetch_array($res);
header("Location:sale2.php?id=$var[id]");
}
else
{
echo "problem";
}
}
}
$resu=mysql_query("select * from category where id='$_REQUEST[id]'");
if($resu)
if(mysql_num_rows($resu))
$v=mysql_fetch_array($resu);
$titl=$v['title'];
$locatio=$v['location'];
$rupe=$v['rupees'];
$descriptio=$v['description'];
$emai=$v['email'];
$hob=$v['hobbies'];
$img=$v['images'];
$imgg=$v['image'];
show_form($titl,$locatio,$descriptio,$rupe,$emai,$ img,$imgg);
function show_form($titl,$locatio,$descriptio,$rupe,$emai,$ img,$imgg)
{
echo"
<form method='POST' action='editsale.php' name='form1' enctype='multipart/form-data' >
<tr> <td> <table align=center border=1 bgcolor=F7F5F4 height=200 width=100%>
<tr><td> Posting Title
<input type='text' name=title value='$titl' size='30' maxlength='70'>
PRICE (INR)
<input type='text' name='rupees' value='$rupe' size='10' maxlength='70'>
Specific Location
<input type='text' name='location' value='$locatio' size='30' maxlength='70'></td></tr>
<div class='row'>
<br>
<tr><td> <div><span class='req'>Reply to: </span></div>
<div>
<input style='color: rgb(170, 170, 170);' tabindex='1' class='req df' id='FromEMail' name='email' size='30' value='$emai' maxlength='60' type='text'>
<br>
<br> </div>
</div>
<br clear='all'>
</td></tr>
<tr><td> Post description <br>
<textarea name='description' cols=140 rows=10 value='$descriptio'>$descriptio</textarea></td></tr>
<input type ='hidden'name='id' value='$_REQUEST[id]'>
<tr><td> <input type='submit' name='submit' value='update' ></td></tr></table>";
<tr><td>upload: <input type='file' name='images' value=''>
<img src='$img' width=70 height=70></td></tr>
<tr><td>upload: <input type='file' name='image' value='$var[image]' >
<img src='$imgg' width=70 height=70></td></tr>
}
/*
-------------------------------------------------------------------------------------------------
if($_REQUEST['id'])
{
if($file=="")
{
$vars='uploads/';
$file=$vars.basename($_FILES['images']['name']);
move_uploaded_file($_FILES['images']['tmp_name'],$file);
}
$result=mysql_query("select * from category where id=$_REQUEST[id]");
if($result)
if(mysql_num_rows($result))
extract(mysql_fetch_assoc($result),EXTR_PREFIX_ALL ,'msg');
if($images=="")
{
$file=$msg_images;
}
$vars='uploads/';
$result=mysql_query("select * from category where id='$_REQUEST[id]'");
if($result)
if(mysql_num_rows($result))
$var=mysql_fetch_array($result);
if(isset($_POST['submit']))
{
$title=$_POST['title'];
$rupees=$_POST['rupees'];
$location=$_POST['location'];
$description=$_POST['description'];
$email=$_POST['email'];
//echo"update category set title='$title',rupees='$rupees',images='$file',loc ation='$location',email='$email',description='$des cription' where id={$_REQUEST['id']}";
$result=mysql_query("update category set title='$title',rupees='$rupees',location='$locatio n',email='$email',description='$description' where id={$_REQUEST['id']}");
if($result)
{
//echo"SELECT id FROM category where email='$email'& title='$title'& rupees='$rupees' & location='$location' & desrciption='$description'";
$res=mysql_query("SELECT id FROM category where id=$_REQUEST[id]");
$var=mysql_fetch_array($res);
header("Location:sale2.php?id=$var[id]");
}
else
{
echo "problem";
}
}
}
$resu=mysql_query("select * from category where id='$_REQUEST[id]'");
if($resu)
if(mysql_num_rows($resu))
$v=mysql_fetch_array($resu);
$titl=$v['title'];
$locatio=$v['location'];
$rupe=$v['rupees'];
$descriptio=$v['description'];
$emai=$v['email'];
$hob=$v['hobbies'];
$img=$v['images'];
$imgg=$v['image'];
show_form($titl,$locatio,$descriptio,$rupe,$emai,$ img,$imgg);
function show_form($titl,$locatio,$descriptio,$rupe,$emai,$ img,$imgg)
{
echo"
<form method='POST' action='editsale.php' name='form1' enctype='multipart/form-data' >
<tr> <td> <table align=center border=1 bgcolor=F7F5F4 height=200 width=100%>
<tr><td> Posting Title
<input type='text' name=title value='$titl' size='30' maxlength='70'>
PRICE (INR)
<input type='text' name='rupees' value='$rupe' size='10' maxlength='70'>
Specific Location
<input type='text' name='location' value='$locatio' size='30' maxlength='70'></td></tr>
<div class='row'>
<br>
<tr><td> <div><span class='req'>Reply to: </span></div>
<div>
<input style='color: rgb(170, 170, 170);' tabindex='1' class='req df' id='FromEMail' name='email' size='30' value='$emai' maxlength='60' type='text'>
<br>
<br> </div>
</div>
<br clear='all'>
</td></tr>
<tr><td> Post description <br>
<textarea name='description' cols=140 rows=10 value='$descriptio'>$descriptio</textarea></td></tr>
<input type ='hidden'name='id' value='$_REQUEST[id]'>
<tr><td> <input type='submit' name='submit' value='update' ></td></tr></table>";
<tr><td>upload: <input type='file' name='images' value=''>
<img src='$img' width=70 height=70></td></tr>
<tr><td>upload: <input type='file' name='image' value='$var[image]' >
<img src='$imgg' width=70 height=70></td></tr>
}
/*