You are here: Re: Help with writing data to MySQL database using PHP « PHP Programming Language « IT news, forums, messages
Re: Help with writing data to MySQL database using PHP

Posted by william.clarke on 09/24/06 22:03

Colin McKinnon wrote:
> Bryan wrote:
>
> > Hello all,
> >
> > Can anyone tell me why the following code isn't working?
> >
> > $dbh = mysql_connect($host,$user,$pass) or die("Couldn't connect...");
> > $selected = mysql_select_db($db,$dbh);
> > $name = $_GET['name'];
> > $state = $_GET['state'];
> > $desc = $_GET['desc'];
> > $lat = $_GET['lat'];
> > $lng = $_GET['lng'];
> > $result = mysql_query("INSERT INTO re_cities (name, state, description,
> > lat, lng) VALUES ('$name','$state','$desc','$lat','$lng')");
>
> print "error ='" . mysql_error() . "'<br />\n";
>
> C.

Try storing the query in a variable and echoing/printing it, then you
should be able to see what the query really looks like. Try running the
resulting query through your SQL client of choice, hopefully it will
give you some meaningful feedback. And on a security note you seem to
be putting a lot of trust in those $_GET variables.

 

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

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