Page 1 of 1

Logic of return wrong

Posted: Fri Aug 07, 2009 1:42 pm
by tkojemile
***** Please use the

Code: Select all

tag when posting PHP (and format you code) *****[/color]

Hi,

I have some problem with return... probably in logic - it returns only one data, instead of list.
Class goes like this:

Code: Select all

Class someCs {
//Some code
// and also function that I customised in extendSomeCs below:
function getDateLink()
 
}
 
Class extendSomeCs extends someCs {
 
function getDateLink($day, $month, $year){
 
//now I read from database and return list of dates (e.g. $array='2009-03-04,2009-13-14';)
// in string format as three variables
//$day
//$month
//$year
 
// if correct date is then i set link to "#" and return it:
$link = ""; 
if ($day == $tmp2[0] && $month == $tmp2[1] && $year == $tmp2[2]) {
    $link = "#"; 
}
return $link;
}
}
Now problem is that instead of few $link that I need - for every date in DB I get only one that is returned.
I now that logic is wrong but... cant see straight in this moment!

Does someone has some idea?

Thanks in advance!

Re: Logic of return wrong

Posted: Fri Aug 07, 2009 2:12 pm
by Christopher
What is $tmp2 ?

Re: Logic of return wrong

Posted: Fri Aug 07, 2009 2:28 pm
by tkojemile
parsed date - in days, months & year - so I can compare it with actual date