Re: insert data -



"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.)


.



Relevant Pages

  • Re: PHP under CGI Directory
    ... >trying open a connection to a MySQL database using mysql_connect. ... >MySQL module when they compiled PHP. ... They told me their server is ...
    (comp.lang.php)
  • Re: PHP and MySQL for Windows?
    ... > What's the best way to get my Windows XP machine to run a PHP ... > web server and a MySQL database? ... What software should I download? ... you need to make a decision which HTTP server you want ...
    (alt.php)
  • Re: PHP Learning suggestions...
    ... > I need to develop a PHP web page, that will contact the MySQL database ... > on the server and return specific pieces of information; ... PHP and MySQL properly installed and configured? ...
    (comp.lang.php)
  • Re: automate csv upload to mysql database
    ... I cannot connect directly to the mysql server from anything other then ... how can I automate importing the data into the mysql database. ... with another way, may be PHP, but I cannot schedule anything to run on ... I wonder it there is a way to execute script on my ...
    (comp.unix.shell)
  • Re: insert data -
    ... I try to insert data from a form into a mysql database, ... Petr Vileta, Czech republic ... take a look at php's extract() function ...
    (comp.lang.php)