Call to undefined function mysql_real_escape_string()
11,756
Try using:
$link = mysqli_connect("127.0.0.1", "my_user", "my_password", "my_db");
$value = trim($_POST['image']);
$value = mysqli_real_escape_string($link, $value);
mysqli_close();
Since new php version mysqli is used instead of mysql. Notice the letter "i". Where $link stands for the mysqli_connect.
Author by
Md. Rafsan Biswas
Updated on December 02, 2022Comments
-
Md. Rafsan Biswas over 1 year
//Here is the code from insert.php
if ($_SERVER["REQUEST_METHOD"] == "POST") { if(isset($_POST['image']) && isset($_POST['cate']) ){
$image = mysql_real_escape_string(trim($_POST['image'])); $cate = mysql_real_escape_string(trim($_POST['cate'])); $query_input = "INSERT INTO category(cat_name,image) VALUES('$cate','$image')"; $result_input = insert_fun($query_input);
-
Thamilhan about 7 yearsAre you using PHP 7? Then it is removed. You can't use it. If not this
-
Thamilhan about 7 yearsPossible duplicate of mysql_real_escape_string is undefined
-
Md. Rafsan Biswas about 7 years@Thamilan yes I'm using php
-