| SQL error | |
Posted: 01/30/2006 4:44 AM |
|
|
|
|
Citation |
Posts |
2152 |
Word Cnt. |
78,257 |
BDay |
Jun 15 |
Sign |
Gemini |
Sex |
|
|
|
|
Joined: Apr 22, 2005
Local time: 3:14 AM
Location: Upside down
|
|
|
|
|
|
Sometimes I get an SQL error when I enter the ACP. Here is the error
Code:
|
Could not obtain regd user/online information
DEBUG MODE
SQL Error : 1064 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE page_id = 2230' at line 1
SELECT forum_name, forum_id FROM phpbb_forums
Line : 574
File : index.php
|
Any ideas about this? |
|
|
|
|
Back to Top |
|
|
| SQL error | |
Posted: 01/31/2006 4:55 AM |
|
|
|
|
Site Admin |
Posts |
30756 |
Word Cnt. |
2,628,678 |
BDay |
Jul 28 |
Sign |
Leo |
Sex |
|
|
|
|
Joined: Sep 25, 2004
Local time: 1:14 PM
Location: St Pete, FL
|
|
|
|
|
|
So where do you see this error? I checked in your index.php file in your root and this query is not even run in that file. I checked the index.php file in your admin folder and the query was run on line 395, not 574. And the query that is there is valid...
|
|
|
|
|
Back to Top |
|
|
| Re: SQL error | |
Posted: 01/31/2006 5:02 AM |
|
|
|
|
Citation |
Posts |
2152 |
Word Cnt. |
78,257 |
BDay |
Jun 15 |
Sign |
Gemini |
Sex |
|
|
|
|
Joined: Apr 22, 2005
Local time: 3:14 AM
Location: Upside down
|
|
|
|
|
|
Was getting it sometimes as I entered the ACP. It seems ok now though. |
|
|
|
|
Back to Top |
|
|
| SQL error | |
Posted: 01/31/2006 5:16 AM |
|
|
|
|
Site Admin |
Posts |
30756 |
Word Cnt. |
2,628,678 |
BDay |
Jul 28 |
Sign |
Leo |
Sex |
|
|
|
|
Joined: Sep 25, 2004
Local time: 1:14 PM
Location: St Pete, FL
|
|
|
|
|
|
Strange that this would happen in your Admin index.php file. Unless you've installed a bunch of MODs since you posted, the error message doesn't seem to match the location where the code is defined and run...
|
|
|
|
|
Back to Top |
|
|
| SQL error | |
Posted: 01/31/2006 5:20 AM |
|
|
|
|
Site Admin |
Posts |
30756 |
Word Cnt. |
2,628,678 |
BDay |
Jul 28 |
Sign |
Leo |
Sex |
|
|
|
|
Joined: Sep 25, 2004
Local time: 1:14 PM
Location: St Pete, FL
|
|
|
|
|
|
Ok, I just found a bug in your code that would explain the incorrect error message but not explain why you see it occasionally. Here is the code:
Code:
|
$sql_tpl = "SELECT page_name WHERE page_id = $page_id";
if ( !($result_tpl = $db->sql_query($sql_tpl)) )
{
message_die(GENERAL_ERROR, 'Could not obtain regd user/online information', '', __LINE__, __FILE__, $sql);
}
|
The SQL variable is $sql_tpl yet in the error message, they use $sql, which is wrong. It needs to be $sql_tpl. That won't make the problem go away, but it will report correctly if/when it occurs again...
|
|
|
|
|
Back to Top |
|
|
| SQL error | |
Posted: 01/31/2006 5:26 AM |
|
|
|
|
Site Admin |
Posts |
30756 |
Word Cnt. |
2,628,678 |
BDay |
Jul 28 |
Sign |
Leo |
Sex |
|
|
|
|
Joined: Sep 25, 2004
Local time: 1:14 PM
Location: St Pete, FL
|
|
|
|
|
|
Ok, I see your syntax error. This is the SQL code that is failing:
Code:
|
$sql_tpl = "SELECT page_name WHERE page_id = $page_id";
|
SQL code is always in the same order. It is GIVE ME information FROM some table WHERE something matches something...
Notice that this query doesn't say which table to grab the information from. This code is from the Blank Template MOD and there are 2 errors in less than 3 lines of code. I hope the rest of the code from this MOD is in better shape or you're in trouble...
|
|
|
|
|
Back to Top |
|
|
| Re: SQL error | |
Posted: 01/31/2006 5:46 AM |
|
|
|
|
Citation |
Posts |
2152 |
Word Cnt. |
78,257 |
BDay |
Jun 15 |
Sign |
Gemini |
Sex |
|
|
|
|
Joined: Apr 22, 2005
Local time: 3:14 AM
Location: Upside down
|
|
|
|
|
|
So what do I do about it then? |
|
|
|
|
Back to Top |
|
|
| SQL error | |
Posted: 01/31/2006 5:54 AM |
|
|
|
|
Site Admin |
Posts |
30756 |
Word Cnt. |
2,628,678 |
BDay |
Jul 28 |
Sign |
Leo |
Sex |
|
|
|
|
Joined: Sep 25, 2004
Local time: 1:14 PM
Location: St Pete, FL
|
|
|
|
|
|
The MOD author screwed up his SQL query in 3 places, twice in your admin/index.php file and once in your viewonline.php file. I have corrected those queries along with the error message report error that was in two separate places. Let's hope (s)he didn't make any other serious mistakes like this...
|
|
|
|
|
Back to Top |
|
|
| Re: SQL error | |
Posted: 01/31/2006 6:01 AM |
|
|
|
|
Citation |
Posts |
2152 |
Word Cnt. |
78,257 |
BDay |
Jun 15 |
Sign |
Gemini |
Sex |
|
|
|
|
Joined: Apr 22, 2005
Local time: 3:14 AM
Location: Upside down
|
|
|
|
|
|
|
|
|
|
Back to Top |
|
|
| SQL error | |
Posted: 01/31/2006 6:23 AM |
|
|
|
|
Site Admin |
Posts |
30756 |
Word Cnt. |
2,628,678 |
BDay |
Jul 28 |
Sign |
Leo |
Sex |
|
|
|
|
Joined: Sep 25, 2004
Local time: 1:14 PM
Location: St Pete, FL
|
|
|
|
|
|
Since my changes are completely untested, then it is possible that they too may contain errors. It's also possible that I didn't see other errors from the Blank Template MOD. So don't be surprised if this needs more modification down the road...
It appears that you might have gotten this error in your ACP when a guest was reading one of the Templates you created with this MOD. That's why it didn't happen all the time. That is my guess anyway...
|
|
|
|
|
Back to Top |
|
|
| Information | |
|