phpBBHacks.com - Common SQL Errors
Bad Boy Blog, an unofficial Diddy and Bad Boy fan blog
StatsForums Home   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in
FAQFAQ   SearchSearch   MemberlistMemberlist   TutorialsTutorials   ContactContact Us
Username:    Password:
Remember Me?    
   I Lost My Password!
Bookmark and Share
Post new topic   Reply to topic    phpBBHacks.com Support Forums Forum Index -> phpBB 2: Troubleshooting
 See a User Guidelines violation? Please contact us.
Author Message

Thoul
VIP

Joined: 30 Jul 2002
Posts: 18040
Location: USA

PostPosted: June 2nd 2004, 8:02 am    Post subject: Common SQL Errors Reply with quote

When installing hacks or running a phpBB forum, many people will encounter an error message on their forum that results from a SQL problem. In this tutorial, we'll look at some of the more common of these error messages, what actually causes the errors, and what you can do to fix them.

Since these error messages are different on a case-by-case basis, we'll be looking at some generic forms of them here. The following placeholders will be used to represent real names in the error messages.
  • Database - The name of your SQL database.
  • Table - The name of a table in your SQL database
  • Table_name - Something representing the name of a table in your SQL database
  • Column - The name of a column in a table.
Back to top
View user's profile Send private message Visit poster's website

Thoul
VIP

Joined: 30 Jul 2002
Posts: 18040
Location: USA

PostPosted: June 2nd 2004, 8:04 am    Post subject: Reply with quote

phpBB Error wrote:
SQL Error : 1146 Table 'database.table' doesn't exist

phpBB Error wrote:
SQL Error : 1054 Unknown column 'column' in 'field list'


These error messages usually appear when a hack has not been fully installed. Many hacks require changes to your forum's database in order to function correctly. A lot of people don't complete the SQL portions of the installation and then come across an error such as one of these. Fixing these errors is usually simply a matter of completing the SQL portion of the installation. See the Installing phpBB Hacks and Running SQL Queries with db_update.php tutorials for more details on installing SQL changes.

It is also possible that these error messages can appear when a hack is installed or coded incorrectly. While the latter is very rare, the former is an easy situation in which to find yourself. When installing SQL changes, you must be certain that the table prefix (the "phpbb_" in a database table name such as "phpbb_config") in the queries matches that being used on your forum. Most automatic installers (including db_update.php files) will do this for you. If you run the queries manually, however, be sure to check the prefix. The prefix being used on your forum can be found in your config.php file, on this line:
Code:
$table_prefix = 'phpbb_';
Back to top
View user's profile Send private message Visit poster's website

Thoul
VIP

Joined: 30 Jul 2002
Posts: 18040
Location: USA

PostPosted: June 2nd 2004, 8:07 am    Post subject: Reply with quote

phpBB Error wrote:
SQL Error : 1146 Table 'database.TABLE_NAME' doesn't exist


While it appears similar to the first error we looked at above, this message represents an entirely different kind of problem. Notice that TABLE_NAME here is written in all capital letters; this is how you know the error message is different. In phpBB coding, it is a convention that constants, which represent unchangeable values, are written completely in uppercase. An example is USERS_TABLE, which is the constant representing the name of your users database table (the name is your table prefix plus the word "users"). This convention is also used in a lot of broader PHP coding.

When PHP encounters something in a script that it believes is a constant, but cannot find a defined value for that constant, the literal meaning becomes the value of the constant. To put it more simply, if the constant TABLE_NAME is not defined, then the value is assumed to be "TABLE_NAME" when used. The error occurs because there is no database table with this name (note that table names are usually case sensitive and constant names are usually different than actual table names).

In order to fix this error, you need to define a constant. When you're installing a hack and you encounter this error, it'll usually be a result of not making an edit to includes/constants.php or accidentally deleting something in that file. Typically, editing constants.php according to the hack's instructions (or restoring what you accidentally deleted) will define the constant.

Sometimes this error message may also appear in another form containing a SQL query like the one below.
phpBB Error wrote:
SELECT * FROM TABLE_NAME
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    phpBBHacks.com Support Forums Forum Index -> phpBB 2: Troubleshooting All times are GMT - 6 Hours
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Links: Big Message Boards - Free JavaScript - phpBB2 - phpbb styles - Suporte phpBB - phpBB Česky - phpBB Turkiye - phpBBArabia.com - phpBB-fr.com - Romanian phpBB online community - phpBB-TW.net - phpBBservice.nl - phpBB Brasil - phpBB Portugal - phpBBpersian.com

Network: iFroggy Hosting - PhotoshopForums.com - Managing Online Forums - ManagingCommunities.com - CommunityAdmins.com - KarateForums.com - Bad Boy Blog - SodaRatings.com - Patrick O'Keefe

< Advertising - Contact Us - Disclosure Policy - Staff - User Guidelines >

Copyright © 2001-2012. iFroggy Network, phpBBHacks.com. All Rights Reserved. Privacy Policy. We Support phpBBHacks.com (of course!).
Powered by phpBB © phpBB Group. phpBB SEO. We are in no way affiliated with the phpBB Group. phpBB is copyright to the phpBB Group.