Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
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 121


or 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:

Code
<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:
Code
<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 handler


Error 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 handler

Error 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.

Sponsored Links
Joined: Jan 2003
Posts: 338
Enthusiast
Enthusiast
Offline
Joined: Jan 2003
Posts: 338
Code
<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:
Code
<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 />


I dont see any differnce in this code

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Most of it's commented out (note the // ) so that it will display the errors.

Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
Here's an easier way of making that temporary change:

Code
if ([:"red"]FALSE && [/]($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 />}

Joined: Jan 2003
Posts: 338
Enthusiast
Enthusiast
Offline
Joined: Jan 2003
Posts: 338
[]JoshPet said:
Most of it's commented out (note the // ) so that it will display the errors. [/]


ups

Sponsored Links
Joined: May 1999
Posts: 3,039
Guru
Guru
Offline
Joined: May 1999
Posts: 3,039
If you are running version 6.3 or later you can also edit this one line in the not_right function:

$showerror = 0;

If you change that to 1 it will show the mysql errors to all.


UBB.threads Developer
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Oh Awesome..... Good to know.

Joined: Mar 2000
Posts: 180
Member
Member
Offline
Joined: Mar 2000
Posts: 180
Beginner question for you guys, but I'm trying to learn...

After I run a repair table, I get the below message, but would like to know what it means:

"Resource id #12 row(s) affected by your query."

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
That's just a confirmation telling you that the repair worked.

I think it means 12 rows needed to be repaired (or the 12th row). Something like that.

Joined: Mar 2000
Posts: 180
Member
Member
Offline
Joined: Mar 2000
Posts: 180
Thanks! I was just curious, because I've just now noticed on the last couple of times I've had to repair that it's given me that "resource id #12" mumbo jumbo, and I wasn't for sure if I had an error somewhere that kept repeating. It does keep throwing up the the "error 127" fairly often as of late, whiping out the front page of our forum...isn't that eroor # normally something on the ISP's end?

Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Yes, I would attribute that to a badly tuned mysql configuration or server.

Joined: Jan 2004
Posts: 79
Power User
Power User
Joined: Jan 2004
Posts: 79
I am not seeing any of this code in 6.4.1. I am getting major error messages. And my board is down. What is the code on 6.4.1

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
In 6.4.1 he made it even easier.

Find this:
Code
<br />      // IF YOU SET THE VARIABLE BELOW TO 1 IT WILL SHOW THE SQL ERRORS TO ALL<br />      // USERS.  USEFUL IF YOU CANNOT LOG IN AND NEED TO SEE THE SQL ERRORS<br />      $showerror = 0;<br />


Change to this:
Code
<br />      // IF YOU SET THE VARIABLE BELOW TO 1 IT WILL SHOW THE SQL ERRORS TO ALL<br />      // USERS.  USEFUL IF YOU CANNOT LOG IN AND NEED TO SEE THE SQL ERRORS<br />      $showerror = 1;<br />

Joined: Jan 2004
Posts: 79
Power User
Power User
Joined: Jan 2004
Posts: 79
Good info to have. thanks

Joined: Feb 2004
Posts: 6
Lurker
Lurker
Offline
Joined: Feb 2004
Posts: 6
Does anyone know what Error 134 mean, or maybe You know where I can get the complete list of errors. Already tried at mysql home page, but its hard to find something there

Joined: Apr 2003
Posts: 31
User
User
Offline
Joined: Apr 2003
Posts: 31
Error 134 means that the table record has crashed, or a record you are trying to access has been deleted.

To find out the meaning of any MySQL error, first you need to download MySQL on your computer. Then lauch a command prompt (cmd.exe on WinXP). Then type
Code
C:\mysql\bin\perror.exe -errorno
(Obviously for Windows only, similar on *Nix). You can use a comma-separated list of error numbers if you wish

(Sorry for bumping this, even though it is sticky...)


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Bill B
Bill B
Issaquah, WA
Posts: 87
Joined: December 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)