Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/279.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php MySql MySql\u real\u escape\u字符串错误_Php_Mysql_Forms_Code Injection_Mysql Real Escape String - Fatal编程技术网

Php MySql MySql\u real\u escape\u字符串错误

Php MySql MySql\u real\u escape\u字符串错误,php,mysql,forms,code-injection,mysql-real-escape-string,Php,Mysql,Forms,Code Injection,Mysql Real Escape String,您不能以这种方式编写代码。如果您想使用mysqli进行php运行查询,mysql函数不能在mysqli中使用。检查此链接:。这是使用mysqli的最佳教程 还要避免使用mysql\u real\u escape\u字符串。 快乐编码 您不能以这种方式编写代码。如果您想使用mysqli进行php运行查询,mysql函数不能在mysqli中使用。检查此链接:。这是使用mysqli的最佳教程 还要避免使用mysql\u real\u escape\u字符串。 快乐编码 对于mysqli调用了类似的函数

您不能以这种方式编写代码。如果您想使用mysqli进行php运行查询,mysql函数不能在mysqli中使用。检查此链接:。这是使用mysqli的最佳教程

还要避免使用mysql\u real\u escape\u字符串。
快乐编码

您不能以这种方式编写代码。如果您想使用mysqli进行php运行查询,mysql函数不能在mysqli中使用。检查此链接:。这是使用mysqli的最佳教程

还要避免使用mysql\u real\u escape\u字符串。
快乐编码

对于mysqli调用了类似的函数

试一试


对于mysqli调用了类似的函数

试一试


如果您详细说明该错误消息,可能会有所帮助。此外,还有更简单的数据库接口(PDO),准备好的语句使繁琐的手动转义变得多余。你能用SQL字符串粘贴代码吗?你如何使用mysql\u real\u转义字符串?你使用的是mysql还是mysqli?你的代码不清楚。选择一个和相关函数,我很乐意学习如何做到这一点。我在学习PHP方面还没有走那么远。我为我的无知道歉,这就是重点。您不能在
mysqli.*
中使用
mysql.*
函数,反之亦然。如果您详细说明错误消息,可能会有所帮助。此外,还有更简单的数据库接口(PDO),准备好的语句使繁琐的手动转义变得多余。你能用SQL字符串粘贴代码吗?你如何使用mysql\u real\u转义字符串?你使用的是mysql还是mysqli?你的代码不清楚。选择一个和相关函数,我很乐意学习如何做到这一点。我在学习PHP方面还没有走那么远。我为我的无知道歉,这就是重点。您不能在
mysqli.*
中使用
mysql.*
函数,反之亦然。
<?php
include("../scripts/createconnect.php");

if(isset($_POST['submitted'])) {

    $username = mysql_real_escape_string ($_POST['username']);
    $password = mysql_real_escape_string ($_POST['password']);


    $sqlinsert = "INSERT INTO Testing (User_Id, username, password)
        VALUES (NULL,'$username', '$password');"; 

    if (!mysqli_query($dbcon, $sqlinsert)) {
        die('error inserting into database');
        } // end of nested if statement

        $newrecord ="Congratulations!";

}  
?>
 $link = new mysqli("localhost", "my_user", "my_password", "dbaname");
 $username = mysqli_real_escape_string ($link,$_POST['username']);
 $password = mysqli_real_escape_string ($link,$_POST['password']);