duta
asked on
"Fatal error: Call to a member function MoveNext() on a non-object"
Hi, experts!
I have a short PHP code, and the code in the Code box is part of the code.
When I uploaded and opened the page, I I got the following error
Fatal error: Call to a member function MoveNext() on a non-object in /home/public_html/test.php on line 10
I have a short PHP code, and the code in the Code box is part of the code.
When I uploaded and opened the page, I I got the following error
Fatal error: Call to a member function MoveNext() on a non-object in /home/public_html/test.php
while (!$result->EOF)
{
echo '<tr>' .
'<td>' . $result -> fields ['Name']. '</td>' .
'<td>' . $result -> fields ['Email'] . '</td>' .
'</tr>';
$result -> MoveNext ();
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you are using PEAR, or some other class i expect to see something like this.
$connection = DB::connect(mysql://$db_username:$db_password@$db_host/$db_database");
$query = "SELECT CURDATE() as date";
$connection->query($query);
if (DB::isError($result)){
die("Could not query the database <br />".$query." ".DB::errorMessage($result));
}else{
while ($result_row = $result->fetchRow()) {
echo $result_row[0];
}
$connection->close();
You there should be a line that says $result = new something();
Can you find that anywhere?
Can you find that anywhere?
Just remove a space from line 10:
CHANGE THIS
$result -> MoveNext ();
TO THIS
$result -> MoveNext();
@Chimeraza
With static classes this is not always the case.
http://nl.php.net/manual/e
Rgrds,
@Chris_Gralike
Noted. Thanks!
Noted. Thanks!
ASKER
The code is in the Code Snippet.
Open in new window