Why can I log on but cannot connect to the database ;? Phpinclude ("sqlInfo. inc "); $ connect & nbsp ;=& nbsp; mysqli_connect ($ host, & nbsp; $ account, & nbsp; $ password) or & nbsp; why can I log on to die ("Couldn't & nbsp; connect, but cannot connect to the database?
include("sqlInfo.inc");
$connect = mysqli_connect($host, $account, $password)
or die("Couldn't connect to server");
$db = mysqli_select_db($connect,"world")
or die("Couldn't connect to database");
$sql = "SELECT * FROM city";
$result = mysql_query($sql)
or die("Couldn't query to table".mysql_error());
while($row = mysql_fetch_array($result))
{
foreach($row as $value)
{
echo "$value
";
}
}
?>
Error message: Couldn't query to table Access denied for user 'odbc '@ 'localhost' (using password: NO)
------ Solution --------------------
Use mysqli to use all mysqli functions
So the next two ....
Echo $ value;
Not echo "$ value ";
What's the significance of using mysqli extension library like this?
------ Solution --------------------
Mysqli_connect () missing the fourth parameter (database name)
The mysql_query and mysql_fetch_array are not consistent with those saved previously.
------ Solution --------------------
Use mysqli to connect to the database
Use mysql_query to operate the database ....
How has someone made this mistake recently? Is it taught by the same teacher?