...
$sql = "SELECT loginid FROM logins WHERE username = '$username' AND password = '$hashedPass'";
try{
//TODO: put this into a common function
$result = DatabaseTools::runSelectQuery($sql);
if(mysql_num_rows($result) == 1)
{
$row = mysql_fetch_assoc($result);
Response::LoginSuccessResponse($row['loginid']);
}
else
{
Response::ErrorResponse(101,'Could not find your information in our system.');
}
} catch (Exception $e)
{
Response::ErrorResponse(101,$e->getMessage());
}
...
Now I am by no means a good PHP programmer. Self taught PHP4 in a few days and now PHP5 in about 3 hours really, so lay off me if things aren't perfect. But just look at that, actual classes and exception handling? Shocking. I swear, I felt like I was writing Java code. And the walkthrough that the PHP main site provides (http://us.php.net/zend-engine-2.php) is very easy to follow with lots of code samples. For anyone who is used to OOD, PHP5 is very easy to pick up and start going. Now if only I could find a nice project to teach myself Perl or Python...