|
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]
|