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

Recommended Answers

All 4 Replies

So what help you need?

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

$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);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.