Code works, but gives MySQL errors


[code]<?php require 'header.php'; ?>

Search IP:



require ‘header.php’;

$IP = $_POST [“IP”];

$getUsers = mysql_query(“SELECT * FROM Members WHERE IP=’$IP’”);
while ($getUsers = mysql_fetch_object($getUsers)){
echo "


"; echo $getUsers->Username . “



It’s supossed to list all the users with the same IP adress.

The error I get is: Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/martin/public_html/searchIPdo.php on line 8

It does list the users, but also gives an error

Is the error thrown on each run of the loop or only once at the end of the loop? If only at the end, you could try this
[php]while (($getUsers = mysql_fetch_object($getUsers)) !== FALSE)[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service