|
Posted by Petr Vileta on 10/31/06 00:36
"VitaminB" <hetmar@web.de> píse v diskusním príspevku
news:1162232099.474267.67990@e3g2000cwe.googlegroups.com...
> Hi Guys,
>
> I try to insert data from a form into a mysql database, but it did not
> work...
>
>
> <?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."')");
It is curious syntax :-) Try this:
$query = "INSERT INTO wholocations('id', 'lat',
'lon','description', 'owner', 'city', 'street', 'zip', 'country')
VALUES('0', $Lat, $Lon, $Name, $Owner , $City, $Street, $ZIP,
$Country)";
$result = mysql_query($query) or die(mysql_error());
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
Navigation:
[Reply to this message]
|