Rhillman81 Posted December 1, 2014 Share Posted December 1, 2014 everytime i run my code i get ( ! ) Warning: mysqli_query() expects parameter 2 to be string, object given in C:\wamp\www\Tutorial\test.php on line 5. i just cant seem to find the error my code looks like this test.php Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted December 1, 2014 Share Posted December 1, 2014 (edited) You were trying to pass a mysql query where it needed to be a query string Try this instead <?php include 'connect.php'; $query = "SELECT * from player where name='Kronus'"; if ($result = mysqli_query($conn, $query)) { if(mysqli_num_rows($result) > 0){ while ($row = mysqli_fetch_assoc($result)) { echo "Kronus's email is " . $row['email']; } } else { die ("could not select players"); } } else { die ("query failed"); } mysqli_close($conn); ?> Edited December 1, 2014 by Ch0cu3r Merged posts Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.