3093 Posts in 875 Topics by 654 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 715 Views |
-
problem with if logic

10 June 2010 at 1:17pm Last edited: 10 June 2010 1:29pm
The method below is producting this debug output.
Debug (StudentSearch_Controller->StudentSearchResults() in line 74 of StudentSearch.php)
waldron
Debug (StudentSearch_Controller->StudentSearchResults() in line 85 of StudentSearch.php)
*...
// Get student search results for display on template
function StudentSearchResults(){
$searchstring=Session::get('SearchString');
Debug::show($searchstring);
if ($searchstring="*") {
$results = DataObject::get('Student','','Lastname,FirstName');
}
else {
$results = DataObject::get('Student',"`Lastname`='".Convert::raw2sql($searchstring)."'",'Lastname,FirstName');}
Debug::show($searchstring);
return $results;}
....
It seems to me that the if statement is setting the value of the searchstring.
Any ideas?
-
Re: problem with if logic

10 June 2010 at 2:48pm
Hi.
It needs to be
if ($searchstring == "*")
There are two equals signs for testing equality. One = is assignment, even in an if-statement.
Mark
-
Re: problem with if logic

10 June 2010 at 8:00pm
Thanks Mark. Do you know, I thought of trying that. Don't know why I didn't! I'm New to PHP and I'm to used to my old foxpro syntax days!
Much appreciated.
| 715 Views | ||
|
Page:
1
|
Go to Top |

