You are here: Re: insert data - « PHP Programming Language « IT news, forums, messages
Re: insert data -

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация