I have the code . It is not properly showing output
<?php
session_start();
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "forextrading";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname );
$link = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (mysqli_connect_errno()) {
//echo "Failed to connect to MySQL: escape string connection " . mysqli_connect_error();
}else{
//echo "escape string connection works properly";
}
// Check connection
if ($conn->connect_error) {
//die("Connection failed: " . $conn->connect_error);
}
//echo "Connected successfully";
//$Email =$_POST["Email"];
//$Password=$_POST["Password"];
$rand="Zen1710";
//$rand= mysql_real_escape_string($rand);
//echo "<br>"."1st one".$rand."<br>";
$rand=mysqli_real_escape_string($link, trim($rand) );
echo "<br>"." 2nd ".$rand."<br>";
//$rand=var_dump($rand);
//echo "<br>"."3rd".$rand."<br>";
$sql = "SELECT ID FROM userinfo WHERE RandomID='$rand' ";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
echo "id: " . $row["ID"]. "<br>";
}
} else {
echo "0 results";
}
?>