php question please!

Soldato
Joined
16 Oct 2007
Posts
7,467
Location
UK
Hello all,

I've got a bit of php that counts the total number of records in my database, and displays it in "** jobs from ** companies"

Code:
<?

error_reporting(0);

function getTotalJobCount(){

  include("jobs_config.php");

	
	mysql_connect($DBHost,$DBUser,$DBPass); 
	mysql_select_db($DBName); 
	
	$strQuery="
	SELECT count(".$DBprefix."ext_postings.id) as totaljobs, count( DISTINCT ".$DBprefix."ext_postings.employer) as totalemployers FROM ".$DBprefix."ext_employers , ".$DBprefix."ext_postings
	WHERE 
	".$DBprefix."ext_postings.employer =  ".$DBprefix."ext_employers.username
	AND expires>".time()." AND ".$DBprefix."ext_postings.active='YES'";
	
	$result=mysql_query($strQuery);

	$row=mysql_fetch_assoc($result);
	
	return $row['totaljobs']." jobs from  ".$row['totalemployers']." companies";

}
 
echo getTotalJobCount();

?>

That bit works fine

I also have another script that displays info (such as IP address) as an image

Code:
<?php
Header ("Content-type: image/png"); 
$img_handle = imageCreateFromPNG("images/bannerboy.png");
$color = ImageColorAllocate ($img_handle, 100, 100, 100);
$ip = $_SERVER['REMOTE_ADDR'];
ImageString ($img_handle, 3, 10, 9, "Your IP: $ip", $color); 
ImagePng ($img_handle); 
ImageDestroy ($img_handle); 
?>

This also works fine.



But i'm trying to combine the two! And having some mixed results....

Basically, i want to have "** jobs from ** companies" on an image.

Any ideas?
Thank you!
 
Last edited:
Back
Top Bottom