Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4067894
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:18:27+00:00 2026-05-20T16:18:27+00:00

I am trying to get MySQL to work for my form submissions. I am

  • 0

I am trying to get MySQL to work for my form submissions. I am having a problem when I try to insert into a table.
When I put information into my form and click submit (in this example the information is “Idea” in one field and “Description” in the other) I get this response:

“You have an error in your SQL syntax;
check the manual that corresponds to
your MySQL server version for the
right syntax to use near ‘desc) VALUES
(‘Idea’,’Description’)’ at line 1”

I am running a .php file from a webserver to execute this script.

Here is my current code:

<?php

mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("date_ideas") or die(mysql_error());
$title=$_POST['title'];
$title=mysql_real_escape_string($title);
$desc=$_POST['desc'];
$desc=mysql_real_escape_string($desc);
$submit="INSERT INTO ideas (title, desc) VALUES ('$title','$desc');";

mysql_query($submit) or die(mysql_error());

echo ("Idea submitted.  Click <a href='Webroot/submit.php'>here</a> to go back and post another idea.");
?>

If you call an echo of the variables used it succeeds at passing through the information, so that’s not the problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T16:18:27+00:00Added an answer on May 20, 2026 at 4:18 pm

    It may be because desc is a keyword in SQL. Try a different name. desc is used to sort results in descending order.

    In general I would recommend to avoid to use reserved words for column names.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to insert information from a form into a database table and then
I am trying to place cleaned form data into a MySQL database using PDO.
I've been trying to get this complex MYSQL query to work exactly right over
Trying to get this query to work. I'm having issues with brackets I think.
I'm trying to get this to work, but I am having issues. What am
I'm trying to get mysql gem installed for use on rails, using jruby, can't
I'm trying to get the mysql gem installed with a fresh install of Snow
I'm trying to get my mysql data in ASP.net MVC3. The mysql Database Name
I'm trying to get a certain data from mysql with fetchAll. I currently have
I'm trying to get a std::string from my database using mysql connexion Here is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.