Insert problem

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Insert problem

Postby ramonlouter » 04. April 2006 09:38

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'); ?>
<?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
ramonlouter
 
Posts: 2
Joined: 04. April 2006 09:24

Postby cj_nza » 04. April 2006 10:45

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)
cj_nza
 
Posts: 53
Joined: 06. September 2005 11:49

thanks

Postby ramonlouter » 05. April 2006 13:04

I have chosen for option 2.

de register_globals on doesn't work.


Thanks for helping me
ramonlouter
 
Posts: 2
Joined: 04. April 2006 09:24

Postby WorldDrknss » 05. April 2006 23:58

<?php
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());
if($rs)
{ $msg = "De tekst is succesvol ingevoerd<br>";
$msg.="<BR><a href=\"klant.php\">Terug naar de klanten pagina</a>";
}
echo( $msg );
?>
http://wdguides.org - XAMPP Tutorials & MORE!!!!
User avatar
WorldDrknss
 
Posts: 292
Joined: 17. September 2005 13:40

Postby MikeS » 06. April 2006 09:47

Hmm, I seem to have a very similar problem, see my XAMPP problem thread....do you have the same problem with UPDATE as well. I have a problem with the data value being truncated if it contains any spaces.
MikeS
 
Posts: 4
Joined: 05. April 2006 16:51


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 107 guests