I would like to replace codes from mysql to mysqli. My earlier codes:
$query = mysql_query("SELECT * FROM table1,table2 WHERE table1.username = '" . $_SESSION['user_logged']. "' AND table2.info_id='$info_id'");
while($row = mysql_fetch_array($query)){
extract($row);}
I migrate the codes in the following way:
$query = mysqli_query($conn,"SELECT * FROM table1,table2 WHERE table1.username = '" . $_SESSION['user_logged']. "' AND table2.info_id='$info_id'");
while($row = mysqli_fetch_array($query)){
extract($row);
}
My earlier codes were working fine but present codes not working. I could not figure out where I am doing wrong.
connection:
$servername = 'localhost';
$username = 'XXXX';
$password = 'XXXXX';
$dbname = 'XXXXX';
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}