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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:08:21+00:00 2026-05-28T05:08:21+00:00

having a bit of trouble adding some data to a database. I have the

  • 0

having a bit of trouble adding some data to a database. I have the file new_entry.php which is a form, which posts the data added to insert_new.php.

Every time the fields are filled in and submitted the data does not go to the database with the error message “Could not add the data to table” appearing..any ideas?

NEW_ENTRY.PHP

<body>
 <form method="post" action="insert_new.php"><!-- form sent to insert_new.php-->
  Section: <input type="text" name="section"/><br />
  Food: <input type="text" name="food"/><br />
  Description: <input type="text" name="description"/><br />
  Price: <input type="text" name="price"/><br />
  <br />
  <input type="submit" value="submit"/>
</form>
</body>

INSERT_NEW.PHP

 <?php 
include 'library/connect.php';//connect to databse
$section = $_REQUEST["section"]; // get data from the HTML form on new student form
$food = $_REQUEST["food"];
$description = $_REQUEST["description"];
$price = $_REQUEST["price"];

mysql_query ("INSERT INTO food_menu (section, food, description, price) VALUES ('$section', '$food', '$description', $price)")/* insert the data to the food_menu table*/
    or die ("Could not add the data to table");//error message

header('Location:index.php');//auto redirect to view page
include 'library/closedb.php';
?>
  • 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-28T05:08:22+00:00Added an answer on May 28, 2026 at 5:08 am

    It seems that you have a mistake at the end of your MySQL query near price.

    Please replace the code below with existing line:

    mysql_query ("INSERT INTO food_menu (section, food, description, price) VALUES ('$section', '$food', '$description', '$price')")
    

    Tell me the result please.

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

Sidebar

Related Questions

I am having a bit of trouble with ADO. I have deployed a database
I am having a little bit trouble with the following. I have multiple form
Having a bit of trouble using the List.Find with a custom predicate i have
I'm having a bit of trouble loading pages into an already-existing colorbox. I have
I'm having a tad bit of trouble getting the jQuery Form Plugin to work
i'm having a bit of trouble trying to write an sql query. i have
I'm working with extjs 2.2.1, having a bit of a trouble adding a button
I'm having a bit of trouble inserting into a sqlite3 database with pdo. You'll
I'm having some trouble getting NH to persist my object graph. I have (something
I'm having trouble inserting data into a table. I have the following tables: track

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.