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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:05:29+00:00 2026-05-23T01:05:29+00:00

I have a form that submits user inputs to the following php script (i’ve

  • 0

I have a form that submits user inputs to the following php script (i’ve excluded the lines which define the mysql info):

if (isset($_POST['ttname'])); {


$dbc = @mysql_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME) OR die('No DB connection');

$ttarray = array(1=> $_POST['mon1'], $_POST['mon2'], $_POST['mon3'], $_POST['mon4'], $_POST['mon5'], $_POST['tue1'], $_POST['tue2'], $_POST['tue3'], $_POST['tue4'],
 $_POST['tue5'], $_POST['wed1'], $_POST['wed2'], $_POST['wed3'], $_POST['wed4'], $_POST['wed5'], $_POST['thu1'], $_POST['thu2'], $_POST['thu3'], $_POST['thu4'],
 $_POST['thu5'], $_POST['fri1'], $_POST['fri2'], $_POST['fri3'], $_POST['fri4'], $_POST['fri5']);

$name = $_POST['ttname'];

$tt = implode(',', $ttarray);



$query = "INSERT INTO Timetable ('NAME','TIMETABLE')
VALUES ($name,$tt)";


$result = mysql_query($query,$dbc) or die('Query Failed');
}

However, whenever i try to to submit data to the form the query fails to execute.

I would be greatful to anybody who could help explain to me why this is happening.

  • 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-23T01:05:30+00:00Added an answer on May 23, 2026 at 1:05 am

    At least something like that:

    $tt = mysql_real_escape_string(implode(',', $ttarray));
    $query = "INSERT INTO Timetable ('NAME','TIMETABLE') VALUES ('$name','$tt')";
    

    1) $tt was not escaped at all

    2) You’ve tired to insert more values than fields available. By changing $tt to '$tt' you will make number of fields the same.

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

Sidebar

Related Questions

I have a form that is validated by js when the user submits it.
I have the following code for my login view: <?php echo $session->flash('auth'); echo $this->Form->create('User',
I have the following code that executes when a form submits: $('input[value=enter highlight]').val(''); Essentially,
I have a button that I would like to disable when the form submits
I have a form that contains a GridView control which is databound to an
I have a form (signup.php) that pops up in a nyroModal window when I
I have a form I want to submit via PHP and following submission I
I have the following login form: <!-- login box --> <form action=php/login.php method=POST id=signin>
I have a form where a user submits his member name, first and last.
I have a form that a user would fill out while creating a ticket

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.