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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:41:57+00:00 2026-06-14T07:41:57+00:00

I want to update a text field in my mysql database but it doesn’t

  • 0

I want to update a text field in my mysql database but it doesn’t change when I run the query. I’ve tried stripping special characters but it still doesn’t work.

UPDATE: It returns the following error: It gives 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 ‘datatext=’LET OP! Aantal Mate’ at line 1

Here is the data:

The HTML

<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
<input type="hidden" name="nr" value="1">
<textarea rows="20" cols="50" name="text"></textarea>
</form>

The PHP

$change_text = $_POST['text'];
$change_nr = $_POST['nr'];
if ((!empty($change_text))&&(!empty($change_nr)))
{
mysql_query("UPDATE table SET datatext='$change_text' WHERE datanr='$change_nr'");
}

Structure MySQL (tablename = table)

datanr = int(6)
order = text utf8_general_ci
  • 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-14T07:41:58+00:00Added an answer on June 14, 2026 at 7:41 am

    The text area is not to blame. your sql references a column name that your table doesn’t seem to have.

    Your schema has datanr and order while the update query has datanr and datatext.

    Some more tips:

    1. don’t use mysql keywords as column or table names or at least escape them with `backticks` if you must.
    2. always validate/sanitise your user input
    3. don’t use mysql but use mysqli, pdo or better yet, a good data access layer
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to query a string (TEXT field in the database) and want
I want to store a set of categories in a mysql database field. The
I have a text field in SQLite database, which I want the user to
I want to convert an integer to text in a mySQL select query. Here's
I have a Table View Controller with cells. I want to update the text
I want to understand how I can update my GUI with a simple text
Is it possible to get the height of a 'text' field from mysql? Or
I want to update 4 Columns in a particular row in MySQL using C#
I can send a query to mysql database with following code: $sql = mysql_query(INSERT
I want to update 2 of my database's fields according to user input.My code

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.