-7
我想在我的SQL插入由GET數據,但我不能插入數據插入數據通過GET
<?php
include("config.php");
$f=$_GET["first_name"];
$l=$_GET["last_name"];
$e=$_GET["email"];
$m=$_GET["mobile"];
$b=$_GET["birthday"];
$g=$_GET["gender"];
$insert="INSERT INTO user (`first_name`, `last_name`, `email`, `mobile`, `birthday`, `gender`)
VALUES ('$f', '$l', '$e', '$m', '$b', '$g')";
mysqli_query($insert);
?>
我通過這個鏈接嘗試插入數據:
你正在使用錯誤的GET數組。 '?f'?這將無法正常工作。你也需要'&'運算符。 –
您也沒有將db連接傳遞給查詢。閱讀手冊http://php.net/manual/en/mysqli.query.php –
您可以[** SQL注入**](https://www.owasp.org/index.php/SQL_Injection )。至於你的問題,考慮一下:你正在''_GET'中使用不存在的值。這並不奇怪,不起作用。 –