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

  • Home
  • SEARCH
  • 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 9173555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:36:25+00:00 2026-06-17T16:36:25+00:00

I am really pulling my hair out on this one. I got a simple

  • 0

I am really pulling my hair out on this one. I got a simple comment section on my self-built php app and I simply want to add a new row if I catch a $_GET parameter. But no matter how I build the MySQL insert request, I get an error.

This is what I have so far:

if(isset($_GET['r'])){
    $replyid = mysql_real_escape_string($_GET['r']);
    $sentnow = date("Y-m-d H:i:s");
    mysql_query("INSERT INTO eis_inbox (messageid, toid, from, contact, seen, message, date) VALUES (NULL, '".$replyid."', 'TESTUSER', 'CONTACTINFO', '0', 'MESSAGE', '".$sentnow."'") or die(mysql_error());
    echo '<meta http-equiv="refresh" content="0;/messages">';
}

My MySQL DB fields are called exactly the same: messageid (auto_increment), toid(int11), from(varchar255), contact(varchar255), seen(int3), message(text) and date(timestamp/CURRENT_TIMESTAMP).

Executing the above page with let’s say “index.php?r=777” should, as I see it, populate my MySQL with a new row as such:

messageid = (AUTO_INCREMENT)
toid = 777
from = TESTUSER
contact = CONTACTINFO
seen = 0
message = MESSAGE
date = 2013-01-17 11:50:01

Instead, I get the following error:

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 'from, contact, seen, message, date) VALUES (NULL, '1', 'TESTUSER', 'CONTACTINFO'' at line 1

Same error shown with “error_reporting(E_ALL)”.

I have looked into this for several days now, and I just can’t find the error… Perhaps I am blind and miss a comma or closing tag or something. Any ideas?

  • 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-06-17T16:36:26+00:00Added an answer on June 17, 2026 at 4:36 pm

    There are some syntax errors in here :

    • There is a missing parenthesis at the end of your generated query.
    • from and date are reserved keywords, enclose them in `.
    • seen and toid are not varchar fields, and therefore their values shouldn’t be enclosed in '.

    Try :

    mysql_query("INSERT INTO eis_inbox (messageid, toid, `from`, contact, seen, message, `date`)
    VALUES (NULL, ".$replyid.", 'TESTUSER', 'CONTACTINFO', 0, 'MESSAGE', '".$sentnow."')");
    

    Warning : this is vulnerable to SQL injections. Don’t use mysql_* commands, try PDO ou mysqli instead. Prepared statements will help avoiding them.

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

Sidebar

Related Questions

I'm pulling my hair out over this one. I have an app that when
I am really pulling my hair out with this one. Flash game, container swf
I'm really pulling my hair out, this must be a simple problem, but I
I'm really pulling my hair out over this one. I'm showing an action sheet
I'm really pulling my hair out on this one, it seems that I'm having
Really ripping my hair out on this one. I have a JAAS Authentication Provider
This one has had me pulling out my hair. I've been trying to deserialize
I'm pulling my hair our here and really can't figure out why this code
I have been literally pulling my hair out with this one and its beginning
I've really been pulling me hair out on this for a while and would

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.