...

View Full Version : session problems....



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());

marek_mar
03-13-2007, 03:49 PM
Is the username column unique?

the-dream
03-13-2007, 03:52 PM
next time can you wrap your code in the PHP tags. built in to VB.

quintin
03-13-2007, 04:04 PM
when you mean uniqe do you mean that there only one name under username then no.should it be?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum