Jump to content

Can Someone Take A Look?


barryflood22

Recommended Posts

The below is script is part of a script which echo's a list of information with links from a database, it counts how many rows there are and displays the number beside it.

 

would anyone be able to edit it so that if the row count = 0, then it should not display any heading for that row?

 

 

<?php
/**
* @package RAM_ListSectors
* @version 1.6.0 Stable, June 2012
*/

class mod_RAM_ListSectorsHelper {
//
// get list of sectors from  Recruitment Agency Manager
//
function getSectorList($no_to_display)	{
global $msg;

$sectors = array();

//get the database configuration settings
$conf =& JFactory::getConfig();
$dbprefix = $conf->getValue('config.dbprefix');

// get a handle for the std joomla DB connection (only so we can get data already translated by Joomfish!)
$db =& JFactory::getDBO();

$query="SELECT * FROM ".$dbprefix."RAM_Sectors ORDER BY display_order, `desc` ASC limit 0, $no_to_display ";
// $msg = "SQL: $query<br />\n";
$db->setQuery( $query ); // for Joomfish!
$sth = $db->loadAssocList(); // for Joomfish!
$num_rows = count($sth);
// records found?
if ($num_rows>0) {
// yes
$rownum=0; // yes
while ($row=$sth[$rownum]) {
$sectors[] = $row; // add the sector details to the array
$rownum++; // go to the next record
}

} else { // no, return error message

$msg = JText::_('RAM_LSM_NOSECTORS');

} // eof check for records found

	return $sectors; // return any sectors found

} // end function getSectorList

//
// Get the no. of jobs for a specified sector
//
function getJobs($sector) {

//get the database configuration settings
$conf =& JFactory::getConfig();
$dbprefix = $conf->getValue('config.dbprefix');

// get a handle for the std joomla DB connection (only so we can get data already translated by Joomfish!)
$db =& JFactory::getDBO();

$query="select count(*) from ".$dbprefix."RAM_jobs where `sector` = '$sector' and jobfilled='n' AND `approved`='y' and published='y' ";
$db->setQuery( $query );
$sth = $db->loadAssocList();
$row=$sth[0];
$num_rows=$row['count(*)'];

return $num_rows;

} // end function getJobs

} // eof class

?>

Edited by barryflood22
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.