RE: [PHP] Code dilema --> '".NULL."' or '.NULL.' or ...
| From: | John Holmes | Date: | Mon, 03 Jun 2002 16:28:29 +0000 |
| Subject: | RE: [PHP] Code dilema --> '".NULL."' or '.NULL.' or ... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-100421@lists.php.net to get a copy of this message | ||
> // Add together proper fields to enter birth date
> $fecha_nac = $ano_nac + "-" + $mes_nac + "-" + $dia_nac;
That's not the correct way to join strings. Use . instead of +
>
> // 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);
$result = MySQL_query($query) or die(MySQL_error());
That will at least tell you why the query isn't working...
---John Holmes...