<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html">jobberBase Community - Help with a Function</title>
	<link rel="self" href="/forum/rewrite.php"/>
	<updated>2009-11-29T12:35:09Z</updated>
	<generator>FluxBB</generator>
	<id>http://www.jobberbase.com/forum/topic2081-help-with-a-function.html</id>
		<entry>
			<title type="html">Re: Help with a Function</title>
			<link rel="alternate" href="http://www.jobberbase.com/forum/post7706.html#p7706"/>
			<content type="html">Hey you&#039;re awesome!  Missed that somehow ... thanks so much for the quick reply =)</content>
			<author>
				<name>milezteg</name>
			</author>
			<updated>2009-11-29T12:35:09Z</updated>
			<id>http://www.jobberbase.com/forum/post7706.html#p7706</id>
		</entry>
		<entry>
			<title type="html">Re: Help with a Function</title>
			<link rel="alternate" href="http://www.jobberbase.com/forum/post7684.html#p7684"/>
			<content type="html">Hi!

To achieve what you want, open _includes/class.Job.php and find this function GetJobsCountPerCity.
Inside it, you&#039;ll see if ($count &gt; 0). Change 0 to whatever value you wish (if you want at least 2 jobs, then change 0 to 1).

Please note that &#039;Sidebar - show only cities with jobs&#039; must be set to yes for this to work correctly.</content>
			<author>
				<name>putypuruty</name>
			</author>
			<updated>2009-11-27T17:21:38Z</updated>
			<id>http://www.jobberbase.com/forum/post7684.html#p7684</id>
		</entry>
		<entry>
			<title type="html">Help with a Function</title>
			<link rel="alternate" href="http://www.jobberbase.com/forum/post7679.html#p7679"/>
			<content type="html">In the sidebar on the home page you can see a list of all jobs in all cities.  I have a huge list of cities so I am trying to shorten this list a bit by only showing cities with at least 2 jobs in them.

Here is the function:

[code]	public function GetNumberOfJobsInOtherCities()
	{
		global $db;
		
		$sql = &#039;SELECT COUNT(id) AS total FROM &#039;.DB_PREFIX.&#039;jobs WHERE is_temp = 0 AND is_active = 1 AND city_id IS NULL&#039;;

		$result = $db-&gt;query($sql);
		
		$row = $result-&gt;fetch_assoc();
		
		return $row[&#039;total&#039;];
	}[/code]

I have tried a lot of things but I not a SQL guru.  The following did not work:  

[code]$sql = &#039;SELECT COUNT(id) AS total FROM &#039;.DB_PREFIX.&#039;jobs WHERE is_temp = 0 AND is_active = 1 AND city_id IS NULL GROUP BY id HAVING total &gt; 3&#039;;[/code]

Any ideas guys??</content>
			<author>
				<name>milezteg</name>
			</author>
			<updated>2009-11-27T09:43:40Z</updated>
			<id>http://www.jobberbase.com/forum/post7679.html#p7679</id>
		</entry>
</feed>

