Logic of return wrong

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tkojemile
Forum Newbie
Posts: 5
Joined: Mon Aug 03, 2009 8:37 am

Logic of return wrong

Post 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!
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Logic of return wrong

Post by Christopher »

What is $tmp2 ?
(#10850)
tkojemile
Forum Newbie
Posts: 5
Joined: Mon Aug 03, 2009 8:37 am

Re: Logic of return wrong

Post by tkojemile »

parsed date - in days, months & year - so I can compare it with actual date
Post Reply