Hi
I have a form that would allow me to manually insert/populate our database with relevant data from our clients. This form works great. here is an extract ..
Quote:
<?php
include '../../../anme/config.php';
include '../../anme/opendb.php';
$first_name=$_POST['first_name'];
$last_name=$_POST['last_name'];
$nickname=$_POST['nickname'];
$query = "INSERT INTO clients (first_name,last_name,nickname) VALUES ('$first_name','$last_name','$nickname')";
mysql_query($query);
mysql_close();
?>
|
The thing is, I want to use the same structure now to UPDATE and previous entered data.
For this, I have changed the actual form to having 2 (TWO) input fileds for every data. meaning - in text field "1" I'd put in the current data and in text field "2" of the form, I put in the data as it should appear after the update.
Hence, I changed the SQL "insert" command to "update" and extended the code accordingly but I seem to have some php syntax errors (I am not a php wizzard neither)
Here is the bit of "query" code I changed from the above code to possibly achieve an update ...
Quote:
|
$query = "UPDATE clients (first_name,last_name,nickname) WHERE ('$first_name','$last_name','$nickname') SET (first_name,last_name,nickname) WHERE ('$first_name2','$last_name2','$nickname2')";
|
Logically id wouldn't work, since '$first_name2','$last_name2','$nickname2' are not included in the above $Post array. But this is what I don't know how to add or would I need some "echo" statement instead. (as I said, I am still learning and with your help I will get there, for sure!)
Thanks a lot for your help
