Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
|
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 30th, 2007, 06:23 AM
Authorized User
 
Join Date: Nov 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mark jonas
Default updating a text coloum in mysql

morning

im trying to update a from a form using php with works well for everything other then the TEXTarea i am using in the form to a text tpye field in the database just wonted to no if im using the right query

if (isset($_POST['desc'])){
     $value_desc = trim($_POST['desc']);
     if (!empty($value_desc)){
     $query_desc = "UPDATE hotels SET desc = '$value_desc' WHERE name = '$id'";
         mysql_query($query_desc) or die(mysql_error());
     }
}

this is the error message i get so i guess it is the quary that is wrong

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 = 'this is a test' WHERE name = 'king'' at line 1

any ideas

cheers
mark jonas


 
Old January 30th, 2007, 06:34 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Mark,

"desc" is a reserved word in MySQL and therefore, IMHO not a very good choice for a column name.

You should be able to get the query working by surrounding desc with `, e.g. SET `desc` = '$value_desc'

HTH,

Chris

 
Old January 30th, 2007, 06:40 AM
Authorized User
 
Join Date: Nov 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mark jonas
Default

LOL o now i fill stupid LOL well at least i can say im a beginner and now to sort the dad out the name them coloums in the database LOL

cheers for that mate

mark jonas






Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating VBA calculated Text Box throught Report wintermute Access VBA 2 March 28th, 2008 12:00 PM
MYSQL Prepared Statements for updating failed!? Magi BOOK Beginning Linux Programming, 3rd Edition 1 December 9th, 2007 09:53 AM
updating text fields with option buttons redtechcoms Access VBA 7 February 2nd, 2006 03:14 PM
How to output records into list box with 3 coloum method Access VBA 1 April 29th, 2005 07:40 AM
updating mysql wfrisch PHP Databases 2 August 14th, 2003 01:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.