1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Undefined index: last_post_username (?)

Discussion in 'Troubleshooting and Problems' started by Core Freedom, Sep 16, 2012.

  1. Core Freedom

    Core Freedom Well-Known Member

    In a bit of a panic. Logged off and logged back on to find this server error when clicking on the forum tab. All other tabs work fine:
    Server Error

    Undefined index: last_post_username

    http://www.corefreedom.com/forum/

    Any ideas?
     
  2. Core Freedom

    Core Freedom Well-Known Member

    Got a screenshot of the server error log. Any ideas anyone?

    screen shot.png
     
  3. Arty

    Arty Well-Known Member

    Try running this query in phpMyAdmin:
    Code:
    repair table xf_forum;
     
    Core Freedom likes this.
  4. Core Freedom

    Core Freedom Well-Known Member

    Thank you Arty, but I have no idea what you're saying. :eek:
     
  5. Arty

    Arty Well-Known Member

    You most likely have cPanel or similar control panel for your website. Usually such control panels include phpMyAdmin tool, it is an excellent tool to administrate your databases. Find it, open it in browser.

    On left side select database where your forum tables are located. On right side it will show you list of tables. Click "SQL" tab on right side, paste that query, click "Go" button.
     
    Core Freedom likes this.
  6. borbole

    borbole Well-Known Member

    Running a repair of the table it will not help because this is not a crashed table case. That being said, from the error message you posted it looks like you have a missing field in the forum table (last_post_username). Can you go to the phpmyadmin, select the db that your forum is installed at and check the structure for the forum table and see if the field in question is in there or is indeed missing. Hope it helps.
     
    Core Freedom likes this.
  7. Arty

    Arty Well-Known Member

    Its not just one field. If you'll look at screenshot, field find_new is also missing. Most likely other fields are missing too.
     
    Core Freedom likes this.
  8. borbole

    borbole Well-Known Member

    Indeed, I noticed a message about the find_new field too after taking a closer look.
     
    Core Freedom likes this.
  9. Core Freedom

    Core Freedom Well-Known Member

    Thank you, I would never have found that. I did as you suggested but it didn't work. See screen shot.
    sql.png
     
  10. borbole

    borbole Well-Known Member

    Try to view the structure of the forum table and post here a screenshot of it.
     
    Core Freedom likes this.
  11. Arty

    Arty Well-Known Member

    Select xf_forum table on left, click Structure tab (if it will not be selected automatically) on right and post screenshot please.

    edit: a little bit too late :)
     
    Core Freedom likes this.
  12. Core Freedom

    Core Freedom Well-Known Member

    did I do this right?

    xfforumtable.png
     
  13. Arty

    Arty Well-Known Member

    Wrong table ;)
    Click xf_forum on left side, not xf_link_forum
     
    Core Freedom likes this.
  14. Core Freedom

    Core Freedom Well-Known Member

    didn't even see that, sorry 'bout that. This screenshot is too big, has way too many lines...

    xfforumtable.png
     
  15. borbole

    borbole Well-Known Member


    Yes, it is the right table but click the Structure button.
     
    Core Freedom likes this.
  16. Core Freedom

    Core Freedom Well-Known Member

    I promise I'm not blonde... :p xfforumtablestructure.png
     
  17. Arty

    Arty Well-Known Member

    3 fields are missing: discussion_count, last_post_username and find_new.

    Run this query (click "SQL" tab on right, paste code, click "Go"):
    Code:
    ALTER TABLE xf_forum ADD discussion_count INT UNSIGNED NOT NULL DEFAULT 0, last_post_username VARCHAR(50) NOT NULL DEFAULT '' COMMENT 'Username of most recently-posting user', find_new TINYINT UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Include posts from this forum when running /find-new/threads';
     
    Jake Bunce and Core Freedom like this.
  18. borbole

    borbole Well-Known Member

    lol :D

    It looks like you have several fields missing Blueprint4Love. You can try to re-add them manually or if you have a recent backup then restore that. But this means that you will loose all the users, posts, threads and all the other stuff that were acquired from the time of the back up until now.
     
    Core Freedom likes this.
  19. Core Freedom

    Core Freedom Well-Known Member

    Oh no, Borbole, I don't have a backup. How does this even happen. Logged on this morning, logged off for 30 minutes and when I logged back in it was 'gone.'

    Tried running the inquiry, Arty, but not sure I did it right. When I click on SQL there is a first line already type in. I tried running your query with that line in tact and get an error, I tried removing that first line and adding what you said and it gives me an error too. :confused:
    sqlpage.png
     
  20. borbole

    borbole Well-Known Member


    You should remove that first line from your sql box, that starts with SELECT *....

    When you click the sql button to run the query, that box should be empty. There should be no other code in there besides the query that you will run.
     

Share This Page