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 8492851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:50:38+00:00 2026-06-10T22:50:38+00:00

I am having problems with this MySql query: INSERT INTO groups (NAME, DESC, TIME,

  • 0

I am having problems with this MySql query:

INSERT INTO groups (NAME, DESC, TIME, OWNER) VALUES ('$GNAME', '$DESC', '$TIME', '$UID')

Essentially, the script adds the Group Name, Decription, Time and the Username of the person who registered the Group, into the mysql database.

Full script:

<?php
include_once('include/session.php');
$GNAME = $_POST['groupname'];
$DESC = $_POST['desc'];
$SPAM = $_POST['spam'];
$UID = $_POST['UID'];
$TIME = date('Y-m-d H:i:s');
if($SPAM == "queuee"){


$query ="INSERT INTO groups (NAME, DESC, TIME, OWNER) VALUES ('$GNAME','$DESC','$TIME', '$UID')";

$result = mysql_query($query) or die("There as been an Error! <hr>Error:<hr>".mysql_error() ."<br><hr><a href=\"../index.php\">Go Back</a>");
header("Location: ../group.php?id=$GNAME");
}else{
?>
The Security Question was wrong. Try Again.

<?
}
?>

I ran the Query directly into MySql itself using Phpmyadmin. However it still threw an error.
The error is:

#1064 - 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, TIME, OWNER) VALUES ('$GNAME', '$DESC', '$TIME', '$UID')' at line 1

Any help at all is much appreciated and perhaps I am being a complete fool and not noticing an obvious mistake. If you need any more information just ask!

Many Thanks.

  • 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-10T22:50:40+00:00Added an answer on June 10, 2026 at 10:50 pm

    Try:

    INSERT INTO groups (`NAME`, `DESC`, `TIME`, `OWNER`) VALUES ('$GNAME','$DESC','$TIME', '$UID')";
    

    You’re using reserved words as column names – PHP gets terribly confused in that case.

    I should also add that your code is open to SQL injection, and you should look at moving away from using the mysql_* functions.

    The quickstart guide for mysqli is at http://www.php.net/manual/en/mysqli.quickstart.php

    PDO is another option; the information on prepared statements is at http://www.php.net/manual/en/pdo.prepared-statements.php

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

Sidebar

Related Questions

Hi I'm having problems getting this to work in mysql. DELIMITER $$ DROP PROCEDURE
I am having an issue with a simple insert query into a table. I
I'm having troubles with an insert query with MySQL. Here's what I want to
I need button to begin a mysql query to then insert the results into
We're having mysterious network problems with MySQL. Simple update query (updating single row using
I'm having problems updating a mysql database. I want to run this script on
Having problems with a MySQL query. Only returning the results for the first item
I am having problems with this code: <?php $new_value = 'testing'; $con = mysql_connect(localhost,user,pass);
I'm not a MySQL expert and am having problem with this... So, I have
I'm having problems with this site I am building. I need a fixed width

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.