This is a real prize winner this bug.
I have a DB object set up that simply acts as an abstraction layer over the top of the standard Mysql functions. The code goes like this:
include "connectdb.inc.php";
$db = new DBclass;
$sql="select * from whatever";
$db->query($sql);
$row=$db->nl(); //...returns first results row...
Now this code runs fine, its logical, there is nothing complicated here. The DB class is sound, Ive used it on every site I have done in PHP without problem. Its loosely based on the db class in phplib.
The problem is that in some browsers, on the FIRST time it tries to load the page, it throws an "not an object error" when it comes to retrieve the first line of results. Despite the fact that the previous line clearly uses the object, the $db variable ceases to be come that line.
Ive ran it with added lines checking for the existence of the object and its at the exact point of retrieving the results row that the object stops existing.
Additionally the query DOES return a result every time.
Just to add firther confusion to this problem, as soon as the user refreshes the page it works fine. The exact same code does not run first time but runs without problem second time?! How on earth is this possible.
😕
Thanks in advance for any help,
Rene