MySQLi

Blasteh

big tits
Apr 3, 2013
1,156
521
Rules are clear. Everything related to Habbo belongs in the Habbo section.
Hi,
I posted in the Habbo section, but I feel this is a more appropriate section to go for support in regards to coding. So I'm using a CMS that is coded in MySQLi (knock-off of RevCMS) and I've been having some issues.

The news isn't reading correctly for some reason, as you can see:
You must be registered for see images attach


But, it is in the database table (cms_news), and reads right, except for the URL which I'm guessing is due to web.config.
You must be registered for see images attach


Fixed the news preview, just need them to show on /me

The class for news/forms:
PHP:
        final public function getPageNews()
            {
                global $template, $engine;
        
                    if(!isset($_GET['id']) || !is_numeric($_GET['id']))
                    {
                        $_GET['id'] = 1;
                    }
                        $result = dbquery("SELECT title, id FROM cms_news WHERE id != '" . $engine->secure($_GET['id']) . "' ORDER BY id DESC");
                
                        while($news1 = mysqli_fetch_array($result))
                        {
                            $template->setParams('newsList', '&laquo; <a href="index.php?url=news&id='.$news1["id"].'">' . $news1['title'] . '</a><br/>');
                        }
                
                        $news = $engine->fetch_assoc("SELECT title, longstory, shortstory, author, published FROM cms_news WHERE id = '" . $engine->secure($_GET['id']) . "' LIMIT 1");
                        $author = $engine->fetch_assoc("SELECT look FROM users WHERE username = ".$news['author']." LIMIT 1");
                        $template->setParams('newsTitle', $news['title']);
                        $template->setParams('newsContent', $news['longstory']);
                        $template->setParams('newsAuthor', $news['author']);
                        $template->setParams('newsDate', date("M d, Y", $news['published']));
                        $template->setParams('newsPreview', $news['shortstory']);
                        $template->setParams('authorLook', $author['look']);
            
                        unset($result);
                        unset($news1);
                        unset($news);
            }
   
        final public function getPageHome()
        {
            global $template, $engine;
            $a = 1;
            $data = dbquery("SELECT title, id, published, shortstory, image FROM cms_news ORDER BY id DESC LIMIT 5");
                  
            while($news = mysqli_fetch_array($data, MYSQLI_ASSOC))
            {
                $template->setParams('newsTitle-' . $a, $news['title']);
                $template->setParams('newsID-' . $a, $news['id']);
                $template->setParams('newsDate-' . $a, date("d-m-y", $news['published']));
                $template->setParams('newsCaption-' . $a, $news['shortstory']);
                $template->setParams('newsIMG-' . $a, $news['image']);
                $a++;
            }
          
            unset($news);
            unset($data);
        }
      
    }
 

JayC

Always Learning
Aug 8, 2013
5,504
1,401
Well first of all your news page says {newsPreview}

And you don't have a parameter for newsPreview
Code:
 $template->setParams('newsTitle-' . $a, $news['title']);
                $template->setParams('newsID-' . $a, $news['id']);
                $template->setParams('newsDate-' . $a, date("d-m-y", $news['published']));
                $template->setParams('newsCaption-' . $a, $news['shortstory']);
                $template->setParams('newsIMG-' . $a, $news['image']);

It should read {newsCaption-1}
1 = Article ID
 

Blasteh

big tits
Apr 3, 2013
1,156
521
Well first of all your news page says {newsPreview}

And you don't have a parameter for newsPreview
Code:
 $template->setParams('newsTitle-' . $a, $news['title']);
                $template->setParams('newsID-' . $a, $news['id']);
                $template->setParams('newsDate-' . $a, date("d-m-y", $news['published']));
                $template->setParams('newsCaption-' . $a, $news['shortstory']);
                $template->setParams('newsIMG-' . $a, $news['image']);

It should read {newsCaption-1}
1 = Article ID
I have all that in my core:
You must be registered for see images attach


I forgot to mention I fixed the NewsPreview, but I'm more concerned about this:
You must be registered for see images attach
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,135
2,459
This is still related to a CMS, so it belongs in Habbo Help & Support.
It's really easy, if your post contains anything that has to do with Habbo or retro's, it belongs there. Thread moved.
 

Users who are viewing this thread

Top