Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

MySQL table crashes

What am I doing wrong?

1:10 pm on Sep 11, 2005 (gmt 0)

New User

10+ Year Member

joined:Jan 3, 2005
votes: 0

I have a lyrics site driven with PHP + MySQL. My lyrics are in a table type MyISAM. That table is 98.6 MB in size and contains 82,172 records(lyrics) currently. The structure of the table is as follows:

artist varchar(100)
album varchar(100)
song varchar(100)
lyrics text

Last week I was on abroad. When I returned to home and check my site I have seen that there were problems while retrieving data from that `lyrics` table. Then I checked the database with phpMyAdmin and i have seen that table is marked as "In use". After that I tried to repair the table and it worked. My site again started to work as it should. Everything was ok till this morning. When I tried to open my site again, there was that same error in my site. I again checked my database with phpMyAdmin, this time there was not that "In use" message but when I used the "Check Table" feature of phpMyAdmin it gave me an error report about table size. I can't remember the exact error but it was saying that the table isn't at the size that it must be. Anyway, I again repaired my the table and everything seems ok now.

The PHP script is completely written by me and I am not an advance PHP+MySQL programmer. I thought that something wrong with my coding. By the way I have been running this site for about 5 months, and for the last month my visitors increased very much (about 10-15X times greater then before).

In my php pages, whenever I need to access DB I use following function connect:

function con2db () {


$connection = @mysql_connect($dbhost, $dbuser, $dbpass) or die ("Error: Couldn't connect to DB!");

$db = @mysql_select_db($dbname, $connection) or die ("Error: Couldn't select to DB!");

Then I use these type of statements to get recordset:

$rs = mysql_query("Select * From lyrics");

Then I am doing my job(getting data, printing them to output, bla bla...). But I have noticed that I am not using anything to close neither that recordset ($rs) nor the connection. This must be the porblem. Am I right or what do you advice?

P.S: Sorry for my English and thanks for reading until here.

8:15 am on Sept 12, 2005 (gmt 0)

New User

joined:Feb 2, 2005
votes: 0

First thing you should do is check the mysql log file for details on problems/errors.

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members