Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Aiheen aloitti: blodder24 - helmikuu 27, 2009, 08:02:37 IP

Otsikko: Database Error
Kirjoitti: blodder24 - helmikuu 27, 2009, 08:02:37 IP
I included SSI.php in my websites main page and it has the error:

Database Error:
File: Site\SB\forum\Sources\Load.php
Line: 2013

Line 2013 is the first: LIMIT 1", __FILE__, __LINE__);

function sessionWrite($session_id, $data)
{
global $db_prefix;

if (preg_match('~^[A-Za-z0-9]{16,32}$~', $session_id) == 0)
return false;

// First try to update an existing row...
$result = db_query("
UPDATE {$db_prefix}sessions
SET data = '" . addslashes($data) . "', last_update = " . time() . "
WHERE session_id = '" . addslashes($session_id) . "'
LIMIT 1", __FILE__, __LINE__);

// If that didn't work, try inserting a new one.
if (db_affected_rows() == 0)
$result = db_query("
INSERT IGNORE INTO {$db_prefix}sessions
(session_id, data, last_update)
VALUES ('" . addslashes($session_id) . "', '" . addslashes($data) . "', " . time() . ")", __FILE__, __LINE__);

return $result;
}


Any ideas?
Otsikko: Re: Database Error
Kirjoitti: blodder24 - helmikuu 27, 2009, 11:16:38 IP
According to another post: http://www.simplemachines.org/community/index.php?topic=261306.0 (http://www.simplemachines.org/community/index.php?topic=261306.0)

LainaaBasically the timeouts are set too low meaning that mysql is dropping the connection part way through loading the page.
And when smf tries to query the database again its getting the message Mysql has gone away.

I include SSI.php at the beginning of my page to tell whether or not a user is logged in. At this point SMF connects to the dB. Afterwards my main website connects to the dB. Is there something I can do to stop SMF from querying the dB, hide this error, or have SMF and my main website connect to the dB once?

Thanks!
Otsikko: Re: Database Error
Kirjoitti: karlbenson - helmikuu 28, 2009, 07:36:37 AP
SMF has to query the db to find out who is logged in.
Otsikko: Re: Database Error
Kirjoitti: blodder24 - helmikuu 28, 2009, 01:38:05 IP
The query is successful, because it shows that the user it logged in. Is there a way that I can hide the error?
Otsikko: Re: Database Error
Kirjoitti: Rumbaar - maaliskuu 15, 2009, 10:12:02 IP
What is the exact code you are using to call SSI.php and use it?