I just recently upgraded my forum (coding for speed) to PHPBB3.1.5, however, I found out that when your are browsing as bots, it reported a general error:
phpbb-general-error-for-bots
You can verify this by using some web sniffer or modify the user agent to Google bots.
Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
The error is caused by a SQL syntax error at /forum/phpbb/user.php line 235
1 2 3 4 5 6 7 | $sql = 'SELECT * FROM ' . STYLES_TABLE . " s WHERE s.style_id = $style_id"; $result = $db->sql_query($sql, 3600); $this->style = $db->sql_fetchrow($result); $db->sql_freeresult($result); |
$sql = 'SELECT * FROM ' . STYLES_TABLE . " s WHERE s.style_id = $style_id"; $result = $db->sql_query($sql, 3600); $this->style = $db->sql_fetchrow($result); $db->sql_freeresult($result);
Apparently, when $style_id is empty, then the SQL has syntax error. The quick fix is to add single quotes around the variable so it becomes:
1 2 3 4 5 6 7 | $sql = 'SELECT * FROM ' . STYLES_TABLE . " s WHERE s.style_id = '$style_id'"; $result = $db->sql_query($sql, 3600); $this->style = $db->sql_fetchrow($result); $db->sql_freeresult($result); |
$sql = 'SELECT * FROM ' . STYLES_TABLE . " s WHERE s.style_id = '$style_id'"; $result = $db->sql_query($sql, 3600); $this->style = $db->sql_fetchrow($result); $db->sql_freeresult($result);
or you can add before:
1 | if (!$style_id) $style_id = 0; |
if (!$style_id) $style_id = 0;
It is also recommended to use the ` symbol to wrap the table columns/fields, names etc, which should be a good programming practise.
–EOF (The Ultimate Computing & Technology Blog) —
GD Star Rating
loading...
314 wordsloading...
Last Post: Windows Batch Script to Detect Windows Version
Next Post: How to Fix phpBB3.1.5 not indexed by Googlebots?