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`, `joe@joesaddy.net`, `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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.