New to php and even newer to amfphp so consider me an amoeba when it comes to coding... I'm not a developer. I'm just someone who decided to jump in at the deepend one day..
I originally created a php script to to query a mySQL database using PDO. The first query grabs the data and the second query gets the found rows. The script then does its xml magic and sends it to the requesting flash AS3 app.
So, last week I found out about amfphp and became intrigued. It took me that week to understand how to get basic data out of a database and trace it in flash but I got there. So, now I want to reproduce the above in an amfphp service class.. I think I'm ok with the main query and the medoths send the data back to Flash with -
return $stmt->fetchAll(PDO::FETCH_ASSOC);
Worked great. I was so pleased with myself. Then I tried to add a second query to get the total rows and this si where I struggled. In my original script I just ran the main query looped though it for xml output, then ran the second query and appended the result to the xml... but that doesn't seem to work here.
$sqlQ = "SELECT all my data";
$stmt = $this->con->prepare($sqlQ);
$stmt->execute();
return $stmt->fetchAll(PDO::FETCH_ASSOC);
$sqlQ = "SELECT FOUND_ROWS()";
$stmt = $this->con->query($sqlQ);
return = $stmt->fetchColumn(0);
And it failed....
Is it not OK to have two return statements in a method? What approach do I need to take to get this to work... I'm completely in the dark and as a blind man in the world of PHP I'm looking for someone with at least one eye to guide me.