1

//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);
Md. Rafsan Biswas
  • 128
  • 1
  • 2
  • 8

1 Answers1

5

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.

K. Tromp
  • 350
  • 1
  • 13