[PHP][MySQL] Why am i getting this error?

frash23

Member
May 26, 2012
85
12
Hello, i need help again :oops:
Im getting this error:
Code:
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 1 on MySQL result index 48 in /home/a6639703/public_html/article.php on line 92

This is that line:
Code:
    $article->SetParam('news_category', '<a href="/articles/category/' . $articleData['category_id'] . '">' . clean(mysql_result(dbquery("SELECT caption FROM site_news_categories WHERE id = '" . $articleData['category_id'] . "' LIMIT 1"), 0)) . '</a>');

This is the whole file:
Code:
<?php
/*
          |
    .  .|---.,---.,---.
    |  ||  ||---'|        UberCMS 2.0
    `---'`---'`---'`
        UberCMS
        Coded originally by Meth0d (2010-2011)
        Continued by Jonty (2011-now)
     
        Build 2.0.0 SS, Public
*/
 
define('TAB_ID', 5);
define('PAGE_ID', 17);
define("NewsAds", true);
 
require_once "global.php";
 
$articleData = null;
 
if (isset($_GET['mostRecent']))
{
    $getData = dbquery("SELECT * FROM site_news ORDER BY timestamp DESC LIMIT 1");
 
    if (mysql_num_rows($getData) > 0)
    {
        $articleData = mysql_fetch_assoc($getData);
    }
}
else if (isset($_GET['rel']))
{
    $rel = filter($_GET['rel']);
 
    if (strrpos($rel, '-') >= 1)
    {
        $bits = explode('-', $rel);
        $id = mysql_real_escape_string($bits[0]);
     
        $getData = dbquery("SELECT * FROM site_news WHERE id = '" . $id . "' LIMIT 1");
     
        if (mysql_num_rows($getData) > 0)
        {
            $articleData = mysql_fetch_assoc($getData);
        }
    }
}
else if(!isset($_GET['rel']))
{
    Header("Location: ?mostRecent");
}
$tpl->Init();
 
$tpl->AddGeneric('head-init');
$tpl->AddIncludeSet('generic');
$tpl->WriteIncludeFiles();
$tpl->AddGeneric('head-overrides-generic');
$tpl->AddGeneric('head-bottom');
$tpl->AddGeneric('generic-top');
 
$tpl->Write('<div id="column1" class="column">');
 
$newslist = new Template('comp-newslist');
 
if (isset($_GET['archiveMode']))
{
    $newslist->SetParam('mode', 'archive');
}
else if (isset($_GET['category']) && is_numeric($_GET['category']))
{
    $newslist->SetParam('mode', 'category');
    $newslist->SetParam('category_id', $_GET['category']);
}
else
{
    $newslist->SetParam('mode', 'recent');
}
 
$tpl->AddTemplate($newslist);
 
$tpl->Write('</div>');
 
$tpl->Write('<div id="column2" class="column">');
 
$article = new Template('comp-newsarticle');
 
if ($articleData != null)
{
    $article->SetParam('news_article_id', $articleData['id']);
    $article->SetParam('news_article_title', clean($articleData['title']));
    $article->SetParam('news_article_date', 'Posted ' . clean($articleData['datestr']));
    $article->SetParam('news_category', '<a href="/articles/category/' . $articleData['category_id'] . '">' . clean(mysql_result(dbquery("SELECT caption FROM site_news_categories WHERE id = '" . $articleData['category_id'] . "' LIMIT 1"), 0)) . '</a>');
    $article->SetParam('news_article_summary', clean($articleData['snippet']));
    $article->SetParam('news_article_body', clean($articleData['body'], true));
 
    $tpl->SetParam('page_title', 'News - ' . clean($articleData['title']));
}
else
{
    $article->SetParam('news_article_id', 0);
    $article->SetParam('news_article_title', 'News article not found');
    $article->SetParam('news_article_date', '');
    $article->SetParam('news_category', '');
    $article->SetParam('news_article_summary', '');
    $article->SetParam('news_article_body', "The article you were looking for could not be retrieved. Please press the 'back' button on your browser to return to your previous page."); 
 
    $tpl->SetParam('page_title', 'News - News Article not found');
}
 
$tpl->AddTemplate($article);
$tpl->Write('</div>');
 
$tpl->AddGeneric('generic-column3');
$tpl->AddGeneric('footer');
 
$tpl->SetParam('body_id', 'news');
 
$tpl->Output();
 
?>


Can someone help? D:
 

Users who are viewing this thread

Top