0

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());
}
rns
  • 92
  • 10
  • Please explain *not working*. Did you get any error? – Rajdeep Paul Jun 15 '16 at 05:34
  • Do you update your `$conn` variable to use `mysqli_connect` as well? – Sazzadur Rahman Jun 15 '16 at 05:34
  • To this point, mysqli is no different from mysql. So your problem is caused by something else. As nobody can tell you what is wrong with *your* database you are bound to investigate a problem yourself. We can only suggest some tools that will ease the process. For them, refer to the link provided. – Your Common Sense Jun 15 '16 at 05:35
  • I am not getting error. Data is not retrieving – rns Jun 15 '16 at 05:36

0 Answers0