Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
03-10-2009, 02:51 AM #1
- Join Date
- Feb 2009
- Thanked 0 Times in 0 Posts
[MySQL] [PHP] Inserting the values from 3 texboxes in 1 mysql column
Ok, this is very simple question actualy.
I have 3 textboxes: Sur_name, Middle_name and Last_name, but 1 cell called name in MySQL table. The question is how to insert those 3 values in 1 cell??
Thanks in advance.
Here is my current code sample from my script:
$sn = $_POST['sur_name'.$i]; // Sur Name
$gn = $_POST['given_name'.$i]; // Given Name
$mn = $_POST['middle_name'.$i]; // Middle Name
$other_stuff = $_POST['other_stuff'.$i]; // Other Entries
mysql_query("INSERT INTO a
VALUES ('".clean($sn)." ".clean($gn)." ".clean($gn)."', '".clean($other_stuff)."')")
Thank you again for your help."There are 2 kinds of people in the world: the kind that try to divide the world into 2 kinds of people, and the kind that dont."
03-10-2009, 06:21 AM #2
- Join Date
- Dec 2005
- Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
- Thanked 637 Times in 625 Posts
My answer would be: you don't. You add two more columns to your table and store each name separately.
But assuming you don't want to do that, I would handle the quotes a little differently:
VALUES ("'".clean($sn)." ".clean($gn)." ".clean($gn)."'", "'".clean($other_stuff)."')")