Common SQL Error Codes and Solutions:If you are receiving this "generic error":
SQL ERROR: Database error only visible to forum administrators
Warning: Supplied argument is not a valid MySQL result resource in /rd1/www/ubbthreads/mysql.inc.php on line 121or similar, the real error message is being masked. You must first either check your MySQL error logs for the actual error, or edit the mysql.inc.php file to allow it to be displayed, so that you can track down what's wrong.
1. Backup the mysql.inc.php file first.
2. Edit mysql.inc.php file with a text editor
3. Find this near the very bottom:
<br /> if ( ($user['U_Status'] != "Administrator") <br /> && ( (!stristr($What,"createtable")) && (!stristr($What,"altertable")) && (!stristr($What,"ubbimport.php")) ) ) {<br /> $error = "Database error only visible to forum administrators";<br /> }<br /> else {<br /> $this->errordesc = mysql_error();<br /> }<br />
4. Change to this:
<br />// if ( ($user['U_Status'] != "Administrator") <br />// && ( (!stristr($What,"createtable")) && (!stristr($What,"altertable")) && (!stristr($What,"ubbimport.php")) ) ) {<br />// $error = "Database error only visible to forum administrators";<br />// }<br />// else {<br /> $this->errordesc = mysql_error();<br />// }<br />
Now the screen will display the actual error, which you can report. Once the problem is resolved, return the mysql.inc.php file to the original state so that errors are not readily displayed to everyone.
Common Errors: Can't open file: 'w3t_Online.MYI'. (errno: 145) Error Number 145 = Table was marked as crashed and should be repaired.
Generally this query will fix this:
REPAIR TABLE w3t_Online
*Substitue whatever the table name is for "w3t_Online" above to repair whatever database table is corrupted.
SQL ERROR: Unable to do_query: blah blah blah
Got error 28 from table handlerError Number 28 = No space left on device
Verify that your webserver or the partition where the database is stored on your server is not out of space. Once this is corrected, you may need to run the REPAIR TABLE command listed above, as corruption sometimes occurs when MySQL attempts to write data to a full drive.
SQL ERROR: Unable to do query: Blah blah blah Got error 127 from table handlerError 127 = Unknown Error / Record File Crashed
You can generally look at what table or tables it was trying to Query and run the Repair Table command for that table.
For example, if the query throwing the error is the w3t_Posts table, you can try entering this SQL Query:
REPAIR TABLE w3t_Posts
If this does not work, you may need to ask your webhost to run myisamchk on your database. You can also try dumping and restoring the database with the mysqldump command.
If you have more common errors/solutions that should be included here, feel free to post.