Adding mysql_real_escape_string() causes blank values to be stored to database

…衆ロ難τιáo~ 提交于 2019-12-06 06:27:41

As clearly indicated in the manual (which is the first things you should browse, when in doubt):

A MySQL connection is required before using mysql_real_escape_string() otherwise an error of level E_WARNING is generated, and FALSE is returned. If link_identifier isn't defined, the last MySQL connection is used.

Be sure you've connect to your database before using this function.

$link = mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname);

to use this function, you must have a connection opened to your database before, like :

mysql_connect(...);
$fullname=mysql_real_escape_string($_POST['fullname']);
etc ...
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!