Hello master. I need help. I want SQL Query for :- Double quotes string
Here is my code --->
If i uncomment this --> then i see error -->
Notice: Undefined variable: id in /opt/lampp/htdocs/AAKASH/FULL PHP/WebTest/SQLI LEVEL/String-2/index.php on line 25
Here is my code --->
PHP Code
<?php
include 'connection.php';
if(isset($_GET["id"])) {
//$id = '"' . $id . '"';
$id = $_GET["id"];
$query = $conn->query(" SELECT * FROM students WHERE id= ($id) ");
if(!$query) {
echo "Error: " . mysqli_error($conn);
} else {
$data = mysqli_fetch_assoc($query);
echo "<h1>" .$data["firstname"]." ". $data["lastname"] . "</h1>";
}
} else {
echo "<p>Please input the ID as parameter with numeric value like -> ?id=1</p>";
}
If i uncomment this -->
PHP Code
<?php
$id = '"' . $id . '"';
Notice: Undefined variable: id in /opt/lampp/htdocs/AAKASH/FULL PHP/WebTest/SQLI LEVEL/String-2/index.php on line 25


