Author Topic: My Questions  (Read 286 times)

Offline azsxsaz13

  • Hero Member
  • *****
  • Posts: 44
  • Karma: +0/-0
My Questions
« on: April 18, 2014, 04:43:07 AM »
Hi, Alexa
I hope you're well  :)

I found a small problem

where a limited number of My Questions  (page) , does not appear "next" page
would you look at where the problem.I can not fix it

I limit my questions in the file profile.php
code:
Code: [Select]
SmartyPaginate::setLimit(10);

Kind Regards

Offline alexa

  • Administrator
  • Hero Member
  • *****
  • Posts: 490
  • Karma: +7/-1
Re: My Questions
« Reply #1 on: April 19, 2014, 05:33:22 AM »
Hello,

Please try with this profile.php

Code: [Select]
<?php session_start();
include ('settings.php');
$id = htmlspecialchars((int)$_GET['id']);
$arecordSet =&$conn->Execute('SELECT * FROM categori ORDER BY name ASC');
if (!$arecordSet)
    print $conn->ErrorMsg();
else
    while (!$arecordSet->EOF) {
        if ($arecordSet->fields['cord'] == 0) {
            $aval[] = $arecordSet->fields;
        } else {
            $nval[] = $arecordSet->fields;
        }
        $arecordSet->MoveNext();
    }
$brecordSet = &$conn->Execute('SELECT * FROM users WHERE usid =  '.$conn->qstr($id).' LIMIT 1');
if(!$brecordSet)
print $conn->ErrorMsg();
else
while(!$brecordSet->EOF) {
$bval[] = $brecordSet->fields;
$brecordSet->MoveNext();
}
function get_db_results() {
  global $conn;
  $cid = htmlspecialchars((int)$_GET['id']);
  $_query = sprintf('SELECT SQL_CALC_FOUND_ROWS * FROM article WHERE buserid = '.$conn->qstr($cid).' ORDER BY blogid DESC LIMIT %d,%d',SmartyPaginate::getCurrentIndex(),SmartyPaginate::getLimit());
  $brecordSet = $conn->Execute($_query);
  if(!$brecordSet)
    print $conn->ErrorMsg();
  else
    while(!$brecordSet->EOF) {
      $_data[] = $brecordSet->GetRowAssoc(false);
      $brecordSet->MoveNext();
    }
  $_query = "SELECT FOUND_ROWS() as total";
  $crecordSet = $conn->Execute($_query);
  if(!$crecordSet)
    print $conn->ErrorMsg();
  else
    $_row = $crecordSet->GetRowAssoc();
  $total = $crecordSet->fields['total'];
  SmartyPaginate::setTotal($total);
  return @$_data;
  $brecordSet->Close();
  $crecordSet->Close();
}
require ('libs/SmartyPaginate.class.php');
SmartyPaginate::connect();
SmartyPaginate::setLimit(6);
SmartyPaginate::setUrl('profile.php');
$smarty->assign('results',get_db_results());
SmartyPaginate::assign($smarty);
include('includes/session.php');
$smarty->caching = $caching;
$smarty->assign('categori',$aval);
$smarty->assign('subs',@$nval);
$smarty->assign('profile',@$bval);
@$next = htmlspecialchars((int)$_GET['next']);
$smarty->display('profile.php', $next);
$smarty->display('footer.php');
$arecordSet->Close();
$brecordSet->Close();
$conn->Close();
?>