I tried to look for questions with the same issue but I couldn't get their solutions to fit my code.
I keep getting the error:
Object of class mysqli could not be converted to string in line 5
Code:
<?php
function aggiornamento($utente) {
global $conn;
global $_CONFIG;
$selezione = mysqli_query ($conn, "SELECT * FROM ".$_CONFIG['db_account'].".account WHERE login = '".$utente."' LIMIT 1");
while ($account = mysqli_fetch_array($selezione)) {
$_SESSION['IShop_Login']= $account['login'];
$_SESSION['IShop_DR'] = $account['dr'];
$_SESSION['IShop_DB'] = $account['db'];
$_SESSION['IShop_AID'] = $account['id'];
$_SESSION['IShop_Admin'] = $account['Admin_IShop'];
}
}
?>
I tried a few solutions from already asked questions but to no avail. So I'm kindly asking you to correct my code for me and maybe a little explanation of what's going on so I'd learn.
My $conn
:
$conn = mysql_connect($_CONFIG['host'], $_CONFIG['user'], $_CONFIG['pass']);
Whereas $_CONFIG['host'], $_CONFIG['user'], $_CONFIG['pass']
defined as:
$_CONFIG['host'] = "SERVER IP";
$_CONFIG['user'] = "root";
$_CONFIG['pass'] = "PW";
And most importantly, $_CONFIG['db_account'] = "account";
.
But I strongly believe the problem isn't with my $conn
, I could be wrong tho.