since php and mysql where updated your original dont work so i tried to revamp code to mysqli and i still cant get it to work my code is
<?php
include 'connect.php';
$playerinfo = mysqli_query($conn, "SELECT * from player WHERE name='Kronus'");
$playerinfo2 = mysqli_query($conn, $playerinfo) or die ("could not select players");
$playerinfo3 = mysqli_fetch_array($conn, $playerinfo2);
echo "Kronus's email is " . $playerinfo3['email'];
?>
but i get ( ! ) Warning: mysqli_query() expects parameter 2 to be string, object given in C:\wamp\www\Tutorial\test.php on line 5
i cant figure out where i am going wrong
since mysql was changed having issues with video 2
Re: since mysql was changed having issues with video 2
This would be your database connect:
Then you would write it like this:
Of course you can change the $db_conx to $conn if u're more comfortable that way...
Code: Select all
<?php
$db_conx = mysqli_connect("localhost", "root", "", "login2");
// Evaluate the connection
if (mysqli_connect_errno()) {
echo mysqli_connect_error();
exit();
}// else {
//echo "Successful database connection!!!";
//}
?>
Code: Select all
$playerinfo = "SELECT * from player WHERE name='Kronus'";
$playerinfo2 = mysqli_query($db_conx, $playerinfo);
$playerinfo3 = mysqli_fetch_array($playerinfo2, MYSQLI_ASSOC);