Re: insert data -





On Oct 30, 8:14 pm, "VitaminB" <het...@xxxxxx> wrote:
Hi Guys,

I try to insert data from a form into a mysql database, but it did not
work...

There is no error, but the data did not pass thru the table.

This is the short script:
<html>
<head>
<title>Insert Address</title>
</head>
<body>
<p><strong>Insert Address</strong></p>

<?php
print_r($_POST);

$link = mysql_connect("aaa", "aaa", "aaa")
or die("Could not connect: " . mysql_error());
mysql_selectdb("db182527668",$link) or die ("Can\'t use
dbserver : " . mysql_error());

$Lat = $_POST['Lat'];
$Lon = $_POST['Lon'];
$Name = $_POST['Name'];
$Owner = $_POST['Owner'];
$City = $_POST['City'];
$Street = $_POST['Street'];
$ZIP = $_POST['ZIP'];
$Country = $_POST['Country'];

$result = mysql_query("INSERT INTO wholocations('id', 'lat',
'lon','description', 'owner', 'city', 'street', 'zip', 'country')
VALUES('0',
'".$Lat."','".$Lon."','".$Name."' , '".$Owner."' ,'".$City."'
,'".$Street."' ,'".$ZIP."' ,'".$Country."')");
echo $result;
mysql_error();

mysql_close($link);
?>

</body>
</html>

And this is the table:

id int(11) Nein auto_increment
lat decimal(10,6) Nein 0.000000
lon decimal(10,6) Nein 0.000000
description varchar(255) latin1_german2_ci Nein
owner varchar(255) latin1_german2_ci Nein
city varchar(255) latin1_german2_ci Nein
street varchar(255) latin1_german2_ci Nein
zip varchar(20) latin1_german2_ci Nein
country varchar(255) latin1_german2_ci Nein

Thx for your help!!!

Check whether your SQL statement is correct, print it and execute in
the database client, like Query Browser. Check the result of the
mysql_error function - now you just do not print the message it
returns.

Sincerely,
Alexander
http://www.alexatnet.com/ - Zend Framework and Ajax blog

.