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 Link to comment https://forums.phpfreaks.com/topic/292818-confused/ Share on other sites More sharing options...
QuickOldCar Posted December 1, 2014 Share Posted December 1, 2014 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); ?> Link to comment https://forums.phpfreaks.com/topic/292818-confused/#findComment-1498163 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.