Re: insert data -
- From: "strawberry" <zac.carey@xxxxxxxxx>
- Date: 31 Oct 2006 02:15:28 -0800
Petr Vileta wrote:
"VitaminB" <hetmar@xxxxxx> píse v diskusním príspevku
news:1162232099.474267.67990@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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.)
Also, take a look at php's extract() function
.
- References:
- insert data -
- From: VitaminB
- Re: insert data -
- From: Petr Vileta
- insert data -
- Prev by Date: Re: When is an array not an array?
- Next by Date: slashes
- Previous by thread: Re: insert data -
- Next by thread: Re: If Statement Problem
- Index(es):
Relevant Pages
|