Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-13-2007, 12:17 PM   PM User | #1
quintin
New to the CF scene

 
Join Date: Mar 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
quintin is an unknown quantity at this point
session problems....

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());
quintin is offline   Reply With Quote
Old 03-13-2007, 03:49 PM   PM User | #2
marek_mar
Sensei


 
Join Date: Aug 2003
Location: One step ahead of you.
Posts: 2,815
Thanks: 0
Thanked 3 Times in 3 Posts
marek_mar is on a distinguished road
Is the username column unique?
__________________
I'm not sure if this was any help, but I hope it didn't make you stupider.

Experience is something you get just after you really need it.
PHP Installation Guide Feedback welcome.
marek_mar is offline   Reply With Quote
Old 03-13-2007, 03:52 PM   PM User | #3
the-dream
Regular Coder

 
the-dream's Avatar
 
Join Date: Mar 2007
Location: Northamptonshire, UK
Posts: 477
Thanks: 8
Thanked 4 Times in 4 Posts
the-dream can only hope to improve
next time can you wrap your code in the PHP tags. built in to VB.
__________________
Branchr Advertising Network
the-dream is offline   Reply With Quote
Old 03-13-2007, 04:04 PM   PM User | #4
quintin
New to the CF scene

 
Join Date: Mar 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
quintin is an unknown quantity at this point
when you mean uniqe do you mean that there only one name under username then no.should it be?
quintin is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:02 AM.


Advertisement
Log in to turn off these ads.