Help with updating database record
Posted 19 May 2006 - 08:39 PM
Here is the breakdown.
1 MySQL Table with email as username, password, and a bunch of other profile fields.
1 working registration page and login page.
The registration page inserts the new email and password into the DB after checking for unique email.
The login page succesfully logs you in because I am calling the session username and it displays the correct email that I logged in with, I have created three test records.
So here is the issue. When you successfully login I take you to a profile update page. This will show your email and password along with all those other fields so that you can fill them out or change them and then Update the record. Well that works sort of, I can make changes to the data it shows and click update and it all gets updated but......
The problem is that no matter who I log in as it ALWAYS shows the first record. It isnt taking the email (username field) and matching it up to the correct record to show the data.
So how can I correct this? I can post code upon request or you can take a look here at the actual site and test it. [a href=\"http://www.redesign.maximumdirt.com/profiles.php\" target=\"_blank\"]http://www.redesign.maximumdirt.com/profiles.php[/a]
Any help would be greatly appreciated!!!
Posted 21 May 2006 - 06:13 AM
<?php $sql = "SELECT * FROM table WHERE email = '" . $_SESSION['email'] . "'"; ?>
Your query to get the correct record would look something like that. Then, when you want to update the record, use something like this:
<?php $sql = "UPDATE table SET blah = '$blah' WHERE email = '" . $_SESSION['email'] . "'"; ?>
Your update query would look something like that, but more complex.
Posted 25 May 2006 - 12:50 AM
[img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]
Got it figured out!
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users