Code dilema --> '".NULL."' or '.NULL.' or ...
| From: | Ricardo Fitzgerald | Date: | Fri, 02 Jun 0102 21:27:44 +0000 |
| Subject: | Code dilema --> '".NULL."' or '.NULL.' or ... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-100368@lists.php.net to get a copy of this message | ||
Hi,
I'm having troubles trying to insert form data into a mysql db, the
thing is my client wants table data to be splitted, I mean some data
comes from the first form, and the rest from another form.
Then this is a portion of the php script.
// Add together proper fields to enter birth date
$fecha_nac = $ano_nac + "-" + $mes_nac + "-" + $dia_nac;
// Open mysql db
mysql_select_db("intertur");
// SQL query insert all data into a table
$query = "insert into RegistroPersonas values
('".NULL."','".$nombre."',
'".$apellido."', '".NULL."',
'".$direccion."',
'".$ciudad."', '".NULL."', '".NULL."',
'".$pais."', '".$telefono."',
'".$fax."', '".$email."',
'".$login_usuario."', '".$clave."',
'".$fecha_nac."', '".NULL."',
'".NULL."' '".$sexo."', '".NULL."',
'".NULL."', '".NULL."', '".NULL."'
)";
----> My problem is NOTHING gets inserted !!!
----> I filled all empty fields with NULL values
----> It connects to the db but does nothing else
// Do query
$result = mysql_query($query);
// this script has a form at the end, where the remaining fields are
// filled
// and calls the next script, where the tables are altered
// there and the empty fields filled with the values retrieved
I suppose to use Update in the next script , to enter remaining
data, but I'm not sure because the first field auto increments,
and is the primary key.
TIA
Rick
AXIS Computers