I am trying to connect my PHP code to my sql backend, and I am coming across and error saying "Warning: mysqli_query() expects parameter 1 to be mysqli, string given in - on line 23 Error querying database."
I am following this guide. https://coolestguidesontheplanet.com/how-to-connect-to-a-mysql-database-with-php/
$link = mysqli_init();
$success = mysqli_real_connect(
$link,
$host,
$user,
$password,
$db,
$port,
$socket
) or die("error");
$query = "select * from Account_data";
mysqli_query($db, $query) or die('Error querying database.');
The first section(up to mysqli_querry) of the code works. However the syntax of the lines appears to be correct compared to the guide.
Any ideas?
Thanks in advance.