Page 1 of 1

Insert problem

PostPosted: 04. April 2006 09:38
by ramonlouter
I have the following script and have installed the newest version of Xampp.

I have tested this on a online domain with php access. The script is working fine there. I want to execute the script offline in the localhost.

Can anyone tell me why the script is not working properly. The script only insert a row with the ID, but the values not. The values are correct written, otherwise they were not working online.

<?php include ('db_connect.php'); ?>

$query= "INSERT INTO klant (`voornaam` , `achternaam` , `adres` , `plaats` , `postcode` , `telefoon_prive` , `telefoon_mobiel` , `geboortedatum` , `notities` )

VALUES ('$voornaam', '$achternaam', '$adres', '$plaats', '$postcode', '$telefoon_prive', '$telefoon_mobiel', '$geboortedatum', '$notities')";
mysql_query($query) or die (mysql_error());
echo"De tekst is succesvol ingevoerd<BR>";
echo ("<BR><a href=\"klant.php\">Terug naar de klanten pagina</a>");

Can anyone help me.

GR. Ramon

PostPosted: 04. April 2006 10:45
by cj_nza
Check the values for register_globals in your php.ini file.

Possible that register_globals is on in the online domain, but is by default of in XAMPP.

If that is the case you have two options
1) change register_globals to on in php.ini; or
2) rewrite your code to refer to php global arrays ($_GET, $_POST or $_REQUEST)


PostPosted: 05. April 2006 13:04
by ramonlouter
I have chosen for option 2.

de register_globals on doesn't work.

Thanks for helping me

PostPosted: 05. April 2006 23:58
by WorldDrknss
include_once ('db_connect.php');

$query ="INSERT INTO klant (\"voornaam\", \"achternaam\", \"adres\", \"plaats\", \"postcode\", \"telefoon_prive\", \"telefoon_mobiel\", \"geboortedatum\", \"notities\" ) VALUES (\"$voornaam\", \"$achternaam\", \"$adres\", \"$plaats\", \"$postcode\", \"$telefoon_prive\", \"$telefoon_mobiel\", \"$geboortedatum\", \"$notities\")";
$rs = @mysql_query($query) or die (mysql_error());
{ $msg = "De tekst is succesvol ingevoerd<br>";
$msg.="<BR><a href=\"klant.php\">Terug naar de klanten pagina</a>";
echo( $msg );

PostPosted: 06. April 2006 09:47
by MikeS
Hmm, I seem to have a very similar problem, see my XAMPP problem you have the same problem with UPDATE as well. I have a problem with the data value being truncated if it contains any spaces.