Digicoder
01-14-2008, 11:00 PM
Recently been testing a few things out and everything is working perfect except this one tinny detail.
I've OOPHPed up a query system and it works perfect, I've also constructed a system that will keep track of my users, like when they last moved on the site.
well that works fine too, but the problem I face lies with in the login.
each time you've been off the site, like you get off over night, and you come back, regardless of remember me settings or no, you'll see an error at the bottom of the page.
Warning: mysql_query(): 2 is not a valid MySQL-Link resource in /home/content/i/t/g/itguy45/html/sdfs/includes/functions.php on line 82
Database Error Report:
Error #:
SQL Stated:
Debug info:
#0 dbError() called at [/home/content/i/t/g/itguy45/html/sdfs/includes/functions.php:82]
#1 db->query(UPDATE phpbb_users SET s_online='1200350223' WHERE username='CTB') called at [/home/content/i/t/g/itguy45/html/sdfs/includes/functions.php:193]
Its strange because there is no error info, and on the page the error points to line 82 as the problem, well here is line 82:
public function __construct()
{
$this->host = '';
$this->user = '';
$this->pass = '';
$this->dbase = '';
$this->link_id = mysql_connect($this->host, $this->user, $this->pass) or dbError();
mysql_select_db($this->dbase, $this->link_id) or dbError();
}
public function query($sql, $type=null)
{
// Line 82 of the SQL system.
$this->result = mysql_query($sql, $this->link_id) or dbError();
//. . .
Now I built this system, and I can usually solve all the problems that are produce by it, but this one is just strange.
Its stranger still because the same "link_id" is used for a query on that page just before the actual problem query.
This is the problem query:
public function __destruct()
{
global $db;
$time = time();
if($this->user_id > 1)
$db->query("UPDATE phpbb_users SET s_online='$time' WHERE username='{$this->username}'");
}
So given I have no clue why its doing this, and there is use of the SQL link-id before this query, whats the problem?
EDIT:
BTW, its fine if you refresh the page, it only happens once every new user session.
Thanks for the help guys.
I've OOPHPed up a query system and it works perfect, I've also constructed a system that will keep track of my users, like when they last moved on the site.
well that works fine too, but the problem I face lies with in the login.
each time you've been off the site, like you get off over night, and you come back, regardless of remember me settings or no, you'll see an error at the bottom of the page.
Warning: mysql_query(): 2 is not a valid MySQL-Link resource in /home/content/i/t/g/itguy45/html/sdfs/includes/functions.php on line 82
Database Error Report:
Error #:
SQL Stated:
Debug info:
#0 dbError() called at [/home/content/i/t/g/itguy45/html/sdfs/includes/functions.php:82]
#1 db->query(UPDATE phpbb_users SET s_online='1200350223' WHERE username='CTB') called at [/home/content/i/t/g/itguy45/html/sdfs/includes/functions.php:193]
Its strange because there is no error info, and on the page the error points to line 82 as the problem, well here is line 82:
public function __construct()
{
$this->host = '';
$this->user = '';
$this->pass = '';
$this->dbase = '';
$this->link_id = mysql_connect($this->host, $this->user, $this->pass) or dbError();
mysql_select_db($this->dbase, $this->link_id) or dbError();
}
public function query($sql, $type=null)
{
// Line 82 of the SQL system.
$this->result = mysql_query($sql, $this->link_id) or dbError();
//. . .
Now I built this system, and I can usually solve all the problems that are produce by it, but this one is just strange.
Its stranger still because the same "link_id" is used for a query on that page just before the actual problem query.
This is the problem query:
public function __destruct()
{
global $db;
$time = time();
if($this->user_id > 1)
$db->query("UPDATE phpbb_users SET s_online='$time' WHERE username='{$this->username}'");
}
So given I have no clue why its doing this, and there is use of the SQL link-id before this query, whats the problem?
EDIT:
BTW, its fine if you refresh the page, it only happens once every new user session.
Thanks for the help guys.