[Solved] about mysql query in php [closed]


Your code should work.
It is better to have some protection against SQL injection as below.

  • I have changed addslashes to mysql_real_escape_string. So now it should be alright.

    $name1 = mysql_real_escape_string($_POST[‘name1’]);
    $name2 = mysql_real_escape_string($_POST[‘name2’]);
    $name3 = mysql_real_escape_string($_POST[‘name3’]);
    mysql_query(“INSERT INTO tb_people (name) VALUES (‘$name1’), (‘$name2’), (‘$name3’);”);

5

solved about mysql query in php [closed]