通过GET插入数据

I want insert data by GET in my sql but I can not insert data

<?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);



?>

I try insert data by this link :

http://localhost:8888/restfull/insert.php?f=hayoo

It's been a long time since I have used mysqli the code below should most likely run though. As others have mentioned never bind unsanitized data (Even if you think you trust the data it's safe to use prepared statements still).

<?php
//Create you db connection 
$conn = new mysqli('server', 'user', 'password', 'databasename');
//Create insert statement. Never concat un-sanitized data in statements 
$insert="INSERT INTO user ( `first_name`, `last_name`, `email`, `mobile`, `birthday`, `gender`)
VALUES (?, ?, ?, ?, ?, ?)";


$stmt = $conn->prepare($sql);

//Values corespond to ? except the first param which represents format of expected data. "s" stands for string
$stmt->bind_param(
    'ssssss', 
     $_GET["first_name"], 
     $_GET["last_name"],
     $_GET["email"],
     $_GET["mobile"],
     $_GET["birthday"],
     $_GET["gender"]
);
$stmt->execute();

Your url would look like this: http://localhost:8888/restfull/insert.php?first_name=john&last_name=Doe&email=test@test.com&mobile=0&birthday=May&gender=male

Make sure if you are putting the url above in some type of form you correctly url encode values (I notice many of the values you are collecting will like require it slashes etc).