Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

  • #2
    Senior Coder
    Join Date
    Aug 2003
    Location
    One step ahead of you.
    Posts
    2,815
    Thanks
    0
    Thanked 3 Times in 3 Posts
    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.

  • #3
    Regular Coder the-dream's Avatar
    Join Date
    Mar 2007
    Location
    Northamptonshire, UK
    Posts
    477
    Thanks
    8
    Thanked 4 Times in 4 Posts
    next time can you wrap your code in the PHP tags. built in to VB.

  • #4
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    when you mean uniqe do you mean that there only one name under username then no.should it be?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •