Jump to content

syntax problem?


n8frog

Recommended Posts

Ok. I have been losing my mind trying to figure this one out. I have a very simple php/mysql query that is supposed to insert data into a table on my database. The query syntax looks correct to me but maybe I'm missing something. The query looks like this:

$query=("INSERT INTO frogindex (name, email, city, region, country, title, desc, url, letter) VALUES ('$name','$email1','$city','$region','$country','$title','$desc','$url','$letter')");
mysql_query($query) or die (mysql_error());

This returns an error saying that the syntax is incorrect. The funny thing is that I tried running this query in phpmyadmin and changed the variables out for static data and it worked just fine!?! I am confused.

 

I then tried to get phpmyadmin to create php for me for this query and it gave me this:

$sql= "INSERT INTO `frog_data`.`frogindex` (`name`, `email`, `city`, `region`, `country`, `title`, `desc`, `url`, `letter`) VALUES (`joe`, `[email protected]`, `new york`, `new york`, `usa`, `mysite`, `blablabla`, `http://www.mysite.mine`, `1`)";

 

I entered this into my script to see how it goes and again I got an error saying something about bad syntax. The odd thing is I'm sure that the first bit of code above was working before but does not now. Any help here? The syntax of the first code example seems right to me.

Link to comment
https://forums.phpfreaks.com/topic/214497-syntax-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.