quintin
03-13-2007, 12:17 PM
i have a problem where i can only update the first name in my database details no matter whose logged in.here is the code.Any suggestions?
First part of the code
case 'detail':
echo '<p>
Please enter your details below.</p>
<form action="'.$_SERVER['PHP_SELF'].'" method="post">
<p>Price<br>
<input name="price" type="text" class="textBox"></p>
<p>Area:<br>
<input name="area" type="text" class="textBox"></p>
<p>Description<br>
<input name="description" type="text" class="textBox"></p>
<p><input type="submit" value="Edit Details" name="editdetail"></p>
</form>
';
break;
second part:
if(isset($_POST['editdetail']))
{
$username = $_SESSION['username'];
$price = trim($_POST['price']);
$area = trim($_POST['area']);
$description = trim($_POST['description']);
$do = mysql_query("UPDATE Users SET price = '$price' WHERE username='$username' LIMIT 1") or die(mysql_error());
$dotwo = mysql_query("UPDATE Users SET area = '$area' WHERE username='$username' LIMIT 1") or die(mysql_error());
$dothree = mysql_query("UPDATE Users SET description = '$description' WHERE username='$username' LIMIT 1") or die(mysql_error());
First part of the code
case 'detail':
echo '<p>
Please enter your details below.</p>
<form action="'.$_SERVER['PHP_SELF'].'" method="post">
<p>Price<br>
<input name="price" type="text" class="textBox"></p>
<p>Area:<br>
<input name="area" type="text" class="textBox"></p>
<p>Description<br>
<input name="description" type="text" class="textBox"></p>
<p><input type="submit" value="Edit Details" name="editdetail"></p>
</form>
';
break;
second part:
if(isset($_POST['editdetail']))
{
$username = $_SESSION['username'];
$price = trim($_POST['price']);
$area = trim($_POST['area']);
$description = trim($_POST['description']);
$do = mysql_query("UPDATE Users SET price = '$price' WHERE username='$username' LIMIT 1") or die(mysql_error());
$dotwo = mysql_query("UPDATE Users SET area = '$area' WHERE username='$username' LIMIT 1") or die(mysql_error());
$dothree = mysql_query("UPDATE Users SET description = '$description' WHERE username='$username' LIMIT 1") or die(mysql_error());