View Full Version : Update via Textarea
12-16-2010, 09:00 PM
I'm trying to learn to update a table in mysql from a textarea. <textarea rows="30" cols="60" name="content" /><?php echo $row['content'] ?></textarea>. This is the mysql command i use. mysql_query("UPDATE pages SET content='$content' WHERE id='$id'");. I'm not sure why it's not doing it. Also I'm using tinymce as the editor and the area is hard to edit. If anyone has any suggestions please let me know.
12-16-2010, 11:20 PM
Did you ever get it working using just a plain old textarea element? That's what I would do first, before I got into using an additional editor layer.
12-17-2010, 03:14 AM
Ghost, make sure you are escaping the input. If you are using a WYSIWYG form it is likely inserting elements with quotes in them, and that could be breaking your MySQL query. Not to mention it isn't safe. See the stickies, and the manual page for mysql_real_escape_string() (http://php.net/mysql_real_escape_string).
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.