Page 1 of 1

database is always as empty as my brain...

Posted: Sun Nov 02, 2003 9:54 pm
by Perfidus
OK, what you will see next is not a programming jewell, every suggestion is welcome cause I'm new at PHP. By the way, what is happening is that I have a form that calls this stupid php, when I process the form I've get back the message in the echo line (That's nice) but the database is always as empty as my brain.
Any help?

Code: Select all

<?php
<?php 
$link = mysql_connect('mysql.gestionar.info', 'aa1126', 'kindra'); 
mysql_selectdb("aa3968",$link); 
$sql = "INSERT INTO DatosInmueble ( Modo, Localidad, Zona, Dirección, Habitaciones, Banyos, Superficie, Precio, Descripcion, Gas, Aire_Acond, Pta_Blindada, Ascensor, Garaje, Trastero, Calefaccion, Terraza, Armarios, Balcon, Piscina, cocinael, cocinagas, lavavajillas, cafetera, microhondas, horno, zonajuegos, basket, futbol, tenis, accesplaya, minusvalidos, tele, parabolica, video, equipomus, cajafuerte, tranquilo, entornoint, zonacomer, zonaocionoc, calific, tren, carretera, aeropuerto, iglesia, todoelagno, masde1, masde2, metrosplaya, metroscentro, alarma, toilet)" + 
"VALUES ('$Modo', '$Localidad', '$Zona', '$Dirección', '$Habitaciones', '$Banyos', '$Superficie', '$Precio', '$Descripcion', '$Gas', '$Aire_Acond', '$Pta_Blindada', '$Ascensor', '$Garaje', '$Trastero', '$Calefaccion', '$Terraza', '$Armarios', '$Balcon', '$Piscina', '$cocinael', '$cocinagas', '$lavavajillas', '$cafetera', '$microhondas', '$horno', '$zonajuegos', '$basket', '$futbol', '$tenis', '$accesplaya', '$minusvalidos', '$tele', '$parabolica', '$video', '$equipomus', '$cajafuerte', '$tranquilo', '$entornoint', '$zonacomer', '$zonaocionoc', '$calific', '$tren', '$carretera', '$aeropuerto', '$iglesia', '$todoelagno', '$masde1', '$masde2', '$metrosplaya', '$metroscentro', '$alarma', '$toilet')"; 
$result = mysql_query($sql); 
echo "¡Gracias! Hemos recibido sus datos.\n"; 
?> 
?>

Posted: Mon Nov 03, 2003 3:45 am
by twigletmac

Code: Select all

mysql_selectdb("aa3968",$link);
should be

Code: Select all

mysql_select_db("aa3968",$link);
also add some error handling to the result:

Code: Select all

$result = mysql_query($sql) or die(mysql_error().'<p>'.$sql.'</p>');
Mac

At least it changes!!

Posted: Mon Nov 03, 2003 4:30 am
by Perfidus
Ok, now at least I have some reaction:

You have an error in your SQL syntax near '0' at line 1
0

Posted: Mon Nov 03, 2003 4:50 am
by twigletmac
Just noticed - you're using a + to concenate, whereas PHP uses a period (.). Try changing:

Code: Select all

toilet)" +
"VALUES
to

Code: Select all

toilet)" .
"VALUES
Mac

Any hints about what's going on?

Posted: Mon Nov 03, 2003 4:52 am
by Perfidus
Iws this new mistake on the php I posted below or in the form, or where?

Posted: Mon Nov 03, 2003 5:07 am
by twigletmac
Topic continued here:
viewtopic.php?t=14234&view=next