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

Posted by AlexVN on 10/30/06 18:40

On Oct 30, 8:14 pm, "VitaminB" <het...@web.de> 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

 

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

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