Wednesday, July 23, 2014
   
Text Size
Login

K2 Items disappear

Basically you've woken up this morning, visited your website, and all your K2 articles are gone !!!!

If you login to your Joomla! administration panel (back-end) and look under k2 items, you should get the following error:


  1.  Warning: Invalid argument supplied for foreach() in /home/public_html/administrator/components/com_k2/views/items/tmpl/default.php on line 80 

If I went to K2 Comments, I'd get an additional error:

 


  1.  Warning: Invalid argument supplied for foreach() in /home/public_html/administrator/components/com_k2/views/items/tmpl/default.php on line 80 
  2.   
  3.  Warning: Invalid argument supplied for foreach() in /home/public_html/administrator/components/com_k2/views/comments/tmpl/default.php on line 145 
 
So I checked these pages and the error is at a foreach() line where it's pulling data from the database.  I asked to see the jos_k2_items table and it returned the following error:
 

  1.  #145 - Table './jos_k2_items' is marked as crashed and should be repaired 
 
 
The Quick Fix
 
I managed to fix this with this SQL command .  Note: you need to be able to run SQL commands against your database.  My client had phpMyAdmin installed so I click on "jos_k2_items" table and then click on the "SQL" tab
 
Type the following query:

  1.  REPAIR TABLE jos_k2_items 

 

 

Note that I say "jos_k2_items" because by default that's what it is... If you changed the table prefix when you installed Joomla! on your site (default is "jos_") then you'll need to change this repair table command to match the database table where your K2 articles are stored (eg. "zu1fq_k2_items").

Comments   

Joey
# Joey Wed, 1st September 2010
you my friend are LIFE SAVER.. Question, I am an artist and dabble in developing so fixes like these are truly worth there weight in gold. But why did this occur? It happened just like you stated, I made some updates last night and this morning, POOF they were all gone! First time this has happened, just trying to understand the why. Again, thanks a bunch
Like | Dislike | +1 Reply | Reply with quote | Quote
# Webmaster Mon, 20th September 2010
Hi Joey,

I recreated this error by overloading a Joomla! CMS website with extensions that I've installed and uninstalled. Basically a lot of third party extensions (especially modules) do not have uninstall scripts, so my database had more tables that were no longer used than ones I was actually using.

I think basically, it's too much for your server to handle in terms of having to read a huge database file so housekeeping is key.

I thought I didn't have much installed when it happened to my site; but both my K2 and Remository (=download manager extension) had crashed. And that was only with about 100 downloads of a Joomla! module I had written. Everything that you install will each send several queries to your servers and the database, too many in fact.

Overloading the server was my issue. This isn't saying that this is what caused your error or that K2 are excess code. All I can do is say what happened to me and what fixed it. There are reports that it keeps happening to people but I'm lucky so far.

Glad this got your K2 articles back :c) Happy to help.
Like | Dislike | 0 Reply | Reply with quote | Quote
george
# george Mon, 20th September 2010
Thanks man u saved me from hell it worked perfect like magic
Like | Dislike | 0 Reply | Reply with quote | Quote
anon e guy
# anon Sat, 25th September 2010
Thank you, sir! Regular "repair table" command wasn't available due to the table being crashed - your fix saved my day (week, month?)
Like | Dislike | +2 Reply | Reply with quote | Quote
Viktor
# Viktor Mon, 22nd November 2010
Thanks. Your solution run 100% perfect, I probe the sql sentence and "voila" all structure table and items were restore.

Thaks again.
Like | Dislike | 0 Reply | Reply with quote | Quote
Joe Johnson
# Joe Tue, 28th December 2010
Hey, thanks buddy! This saved me a lot of time... Thanks again.
Like | Dislike | +1 Reply | Reply with quote | Quote
Emax
# Emax Sat, 12th February 2011
Thanks man, works perfect!
Like | Dislike | 0 Reply | Reply with quote | Quote
Nuno
# Nuno Sat, 19th March 2011
Over a 1000 K2 items disappeared after 5 hours installing virtuemart! :cry:
Thanks man, this post saved my site.
God bless you!
Like | Dislike | 0 Reply | Reply with quote | Quote
TazoChai
# TazoChai Tue, 31st May 2011
Thanks for this awesome info here.
Like | Dislike | 0 Reply | Reply with quote | Quote
tomoceus
# tomoceus Mon, 20th June 2011
You saved many days of work for me. Thanks a lot.
Like | Dislike | 0 Reply | Reply with quote | Quote
Kelly Langston
# Kelly Mon, 5th December 2011
THANK YOU! You saved my day, and now I have time to work on my son's Science project...due tomorrow. Can you help with that too?

Seriously, I appreciate your time to post the resolution. Bless you!
Like | Dislike | 0 Reply | Reply with quote | Quote
abdul
# abdul Wed, 7th December 2011
You saved many days of work. Many many Thanks a lot.
Like | Dislike | 0 Reply | Reply with quote | Quote
Rachel Hart
# Rachel Tue, 13th December 2011
You are my hero!!!!!!!
Like | Dislike | 0 Reply | Reply with quote | Quote
Andrew Crossan
# Andrew Fri, 16th December 2011
Masterful!!! One of the best fastest absolute fixes I've ever had to do.
Like | Dislike | 0 Reply | Reply with quote | Quote
bryan
# bryan Tue, 20th December 2011
hello, i have the same problem but it is still not fixed
the SQL says msg_text is OK
i can't figure out what wrong?
Please help me~
Like | Dislike | 0 Reply | Reply with quote | Quote
# Webmaster Sat, 24th December 2011
Hi Bryan,

If you can send me a link or screenshot I can check for you but msg_text does not necessarily indicate a problem with your K2 setup. From memory, this is a joomla variable but I'll wait to hear from you before suggesting anything.

Kind Regards,

Joe
Like | Dislike | +1 Reply | Reply with quote | Quote
Jose Luis
# Jose Thu, 12th April 2012
You are a genius! u save my life! Thanks
Like | Dislike | 0 Reply | Reply with quote | Quote
Bhavik Shah
# Bhavik Sun, 22nd April 2012
awesome bussy....it was not able to figure it out how to solve this i restored it two times from my cpanel but all was waste thn i came across your blog from google and the problem solved with just one line query.. :-)
Like | Dislike | 0 Reply | Reply with quote | Quote
Igor
# Igor Thu, 26th April 2012
I had a similar problem. And I resolve this one. I deleted joomfish. I think if no work foreach in k2 it means that k2 in conflict with joomfish.
Like | Dislike | 0 Reply | Reply with quote | Quote
Jorge Torres
# Jorge Fri, 10th August 2012
:D :lol: :-) Thank you very much, you saved me!
Like | Dislike | +1 Reply | Reply with quote | Quote
Mohamad Zahedi
# Mohamad Wed, 17th October 2012
It was a nightmare!
Thanks thanks many thanks!
Bests
Like | Dislike | +1 Reply | Reply with quote | Quote
abdul paksc
# abdul Sun, 14th April 2013
Thanks you works perfect!
Like | Dislike | +1 Reply | Reply with quote | Quote
Hans12
# Hans12 Tue, 29th October 2013
I would hug you if i could! Thank you so much!
Like | Dislike | +1 Reply | Reply with quote | Quote
Larry Coonrod
# Larry Thu, 3rd April 2014
The fix works great, but the problem is occurring a couple of times a day.

Any idea how to fix permantely?
Like | Dislike | 0 Reply | Reply with quote | Quote
Add Comment

Name:

Email:

Website:

Message:


Latest Posts

  • Joes Quicklist Weblinks (JQW)

    • Thu 17-Jul-14
      Hi, thanks a lot. But I have got a problem with download it. Error: "File could not be found Important!
      Kat  
    • Tue 15-Jul-14
      Hi Artur, I forgot to get back to you sooner. I was going to include a set of instructions to do this ...
      Webmaster  
    • Mon 14-Jul-14
      Hi Skarosg, Not sure if we took this to e-mail but I noticed your site is displaying the images now.
      Webmaster  
    • Fri 11-Jul-14
      Hi, How can I put user name and category of weblink in module, near the date? Thanks..
      Artur
  • Joes Word Cloud (JWC)

    • Tue 17-Jun-14
      I'm using JE 3.1.19 stable.
      alve89