Hello, im a newbie in writing functions but right now im trying to.

I have made the following function

// FUNCTION TO DECIDE WHETHER A PROJECT IS IN BETWEEN PROJECTBEGIN AND
PROJECTEND , YES OR NO

function Activeyesno($month,$day,$year,$Project_id){
$dayactief = mktime(0, 0, 0, $month, $day, $year);
$daytemp = date("Y-m-d", $dayactief);
$resultactive = mysql_query("SELECT * FROM EIAProjecten WHERE
((Project_begindatum >= '$daytemp' AND Project_id = '$Project_id') OR
(Project_einddatum <= '$daytemp' AND Project_id = '$Project_id'))",$db);

$num_rows = mysql_num_rows($resultactive);
if ($num_rows == '1'){
return "red"; }
}


AND i'm calling this function in an while loop

<? echo Activeyesno($month,$day,$year,$Project_id); ?>

(I translated it into english so maybe some mistakes!)

When i try to call the function i get a mysql error every time, even when i
make $resultactive ("SELECT * FROM EIAProjecten") // NO DATE

1. Is it possible to make a sql connection in my function
2. did i do something wrong?

Can somebody help me?

Sjoerd







________________________________________
Sjoerd van Oosten 
Digitaal vormgever [EMAIL PROTECTED]
Datamex E-sites B.V. 
http://www.esites.nl
Minervum 7368 Telefoon: (076) 5 730 730 
4817 ZH BREDA Telefax: (076) 5 877 757 
_______________________________________


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to