jomaro Posted June 23, 2006 Share Posted June 23, 2006 Hi,I am not a programmer but i have good experience of programing, i have been studied but not working with programming.I am sitting 2 days to sort the MySQL results with paging,, but i failed :(This is my script:[code]$where = " AND (";if ($sections != "") $where .= "sectionid IN (". $sections. ") ";if ($sections != "" && $categories != "" ) $where .= " OR ";if ($sections != "" && $categories != "" ) $where .= "cc.id IN (". $categories. ")";$where .= ") ";// query records$query = "SELECT a.*, cc.image AS image" . "\n FROM #__content AS a" . "\n INNER JOIN #__categories AS cc ON cc.id = a.catid" . "\n WHERE a.state = '1'" . $where . "\n AND ( publish_up = '0000-00-00 00:00:00' OR publish_up <= '$now' )" . "\n AND ( publish_down = '0000-00-00 00:00:00' OR publish_down >= '$now' )" . "\n AND published = '1'" . "\n ORDER BY publish_up DESC";$database->setQuery( $query );$rows = $database->loadObjectList();echo $database->getErrorMsg();[/code]I just want to paging the resultsFor example like this:[!--coloro:#000099--][span style=\"color:#000099\"][!--/coloro--]Page 1 of 4Results 1 - 10 of 35[!--colorc--][/span][!--/colorc--]Thanks [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /] Quote Link to comment https://forums.phpfreaks.com/topic/12714-paging-mysql-database-results/ Share on other sites More sharing options...
cmgmyr Posted June 23, 2006 Share Posted June 23, 2006 Take a look at:[a href=\"http://www.php-mysql-tutorial.com/php-mysql-paging.php\" target=\"_blank\"]http://www.php-mysql-tutorial.com/php-mysql-paging.php[/a]This will get you started and you can continue from there Quote Link to comment https://forums.phpfreaks.com/topic/12714-paging-mysql-database-results/#findComment-48775 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.