View Full Version : Update via Textarea

12-16-2010, 08: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, 10: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, 02: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).