0

The code below is my insert statement to get values into my database. However, I now have an update page where users can update their information. I thus have a form in which their initial info is inserted and now they can change it and submit again thereby updating the database with their information.

The WHERE clause shoul probably be the e-mail address of the user (as it is the Primary key)and that should be acccessed via the 'user' session....

Any help.....

$dbc=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die('Failed'.mysql_error());
		mysql_select_db(DB_NAME);
		$query="INSERT INTO member VALUES('".$_POST['first_name']."',
											'".$_POST['last_name']."',
											'".$_POST['pseudo']."',
											'".$_POST['mail']."',
                                                                                        '".$_POST['town']."',
                                                                                        '".($_POST['age'])."',
											'".($_POST['password'])."')";

                $result=mysql_query($query);
3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by sastudent
0

Hi my SQL is a bit rusty so I need a bit of help with the UPDATE statement..

0
$dbc=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die('Failed'.mysql_error());
		mysql_select_db(DB_NAME);
		$query="UPDATE member SET(NAME='".$_POST['first_name']."',
											SURNAME='".$_POST['last_name']."',
											PSEUDO='".$_POST['pseudo']."',
											
                                                                                        TOWN='".$_POST['town']."',
                                                                                        AGE='".($_POST['age'])."',
											PASSWORD='".($_POST['password'])."'
                                                                                        WHERE EMAIL='".$u->getEmail()."')";


                $result=mysql_query($query);
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.