Jump to content

Best way to submit text into MySQL?


DaveLinger

Recommended Posts

Use the function mysql_real_escape_string() on all text fields that will be stored in a MySQL database. (http://www.php.net/mysql_real_escape_string)

Example:
[code]<?php
$q = "insert into yourtable set fieldname1 = '" . mysql_real_escape_string($your_variable) . "'";
$rs  = mysql_query($q) or die("Problem with query: $q<br>" . mysql_error());
?>[/code]

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.