[thelist] broken mysql table

Garth Hagerman hagerman at mcn.org
Wed Nov 21 13:26:48 CST 2007


Hi all-
Good news and bad news. The good news: I've fixed the immediate  
problem, so there's no dire emergency. The bad news: I don't really  
know what happened, or if there's any way to prevent it from happening  
again.

Here's the story. I received word from one of my clients that his  
shopping cart wasn't working. I visited his site, and sure enough, the  
view cart page was always empty, regardless of how many widgets I  
tried to put in it. After investigating possibilities for a bit, I  
found that the problem was in one table of the database, table 'cart'  
which associates the customer's cookie number with the catalog number  
and quantity. When I queried this table through phpmyadmin, I received  
error 127, but no real data. So, I went to the phpmyadmin site,   
searched for that error code, and found the solution. There's a repair  
function buit into phpmyadmin which fixed the problem with a mouse  
click.

While that solves the immediate crisis, it also raises lots of  
questions. How can a database table spontaneously break? Is there  
anything I can do to prevent it from happening again (I have the same  
basic shopping cart running on several sites)? Does it have anything  
to do with the structure of the table or the data put in it?

Here's the structure of the table in question (as exported from  
phpmyadmin):
CREATE TABLE cart (
   cartId int(11) NOT NULL auto_increment,
   cookieId varchar(50) NOT NULL default '',
   itemId varchar(30) NOT NULL default '0',
   qty int(3) NOT NULL default '1',
   PRIMARY KEY  (cartId)
) TYPE=MyISAM;

     thanks in advance-
     Garth


                            * * * * * * * * * * * * * * * *
                                my online portfolio

                           http://garthhagerman.com/





More information about the thelist mailing list