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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:11:56+00:00 2026-06-16T04:11:56+00:00

MySQL gives an error when I try to input data into the following table

  • 0

MySQL gives an error when I try to input data into the following table my_table:

my_table
Columns | data type:
Task    | varchar(20) (primary key)
Descr   | tinytext
start   | time
end     | time

The my_table character set is utf8

I am trying to insert values into the table from a PHP file:

<?php

mysql_connect("localhost", "admin", "passwd") or die(mysql_error());
mysql_select_db("my_table") or die(mysql_error());

$task = $_POST["taskname"];
$descr = $_POST["taskdesc"];
$start = $_POST["starttime"];
$end = $_POST["endtime"];

$insert = "INSERT INTO tasks (task, descr, start, end) 
VALUES ('$task','$descr','$start','$end')";

mysql_query($insert) or die(mysql_error());
mysql_close();

?>

I receive 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 ‘descr, start, end) VALUES (‘Task 1’,’This is a task. This is only a task. This ‘ at line 1

Here is the html that gives the inputs:

<form id="taskentry" method="post" action="create-task.php">
<ul>
    <li><input type="text" name="taskname" placeholder="Task Name"/></li>
    <li><textarea form="taskentry" name="taskdesc" placeholder="Description" rows="5"></textarea></li>
    <li><input type="time" name="starttime"></li>
    <li><input type="time" name="endtime"></li>
    <li class="naked"><input type="submit" name="Save" value="Submit Task" /></li>
</ul>
</form>

I suspect it is a format issue. Can anyone help?

  • 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-16T04:11:57+00:00Added an answer on June 16, 2026 at 4:11 am

    try to insert data using mysql comand prompt, if that works then try to check if your form data is submitted to your action php page or not. you can write a code to test that

    if(isset($_POST["taskname"]) && isset($_POST["taskdesc"]) && isset($_POST["starttime"]) && isset($_POST["endtime"]))
    {
    $task = $_POST["taskname"];
    $descr = $_POST["taskdesc"];
    $start = $_POST["starttime"];
    $end = $_POST["endtime"];
    echo $task."<br />".$descr."<br />".$start."<br />".$end;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

when i try to select and update the same table mysql gives error error
When I try to run the following code in the MySQL console it gives
This sql script gives me error at the VARCHAR and EXIT; . I try
Why does the MySQL query below give error 1066 (Not unique table/alias: 'customer') ?
Given a MySQL table of real estate data, I would like to generate a
When I try to use imap_open I get the following error: Warning: imap_open() [function.imap-open]:
I am trying to transfer a table from MySQL to MSSQL using the data
If I have a column in table with field of type VARCHAR(15) and if
I am trying to install mysql gem, version: 2.7 though it gives an error:
I want to insert mutiple rows in mysql table using php. Data is in

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.