What I Have So Far
$checkMail = $this->_filteredData['AccountEmail'];
$query = "SELECT count(*) FROM AccountDetails WHERE AccountEmai开发者_如何学编程l=?";
$values = array($checkMail);
$this->_DBO->runSelectQuery($query, $values, true);
/////// This is In A Different Class
public function runSelectQuery($query, $values = array(), $returnResults = false)
{
$sth = $this->_DBO->prepare($query);
$sth->execute($values);
}
Finishing Up
My problem is that I don't know how to finish it up, I need to work out how many matches it found.
There will only be 1 match if any as emails are unique in the table so it will either return 0 or 1. If it returns one I also need to get the other data from the table, its password value and its id number.I don't know if this is the right way to go about doing this so any feedback will be appreciated.
Thanks ChrisJust specify the password and ID value in the same query. It will either return a result or it won't if there is no match.
$query = "SELECT id, password FROM AccountDetails WHERE AccountEmail=? LIMIT 1";
you need to use a
$count = $sth->fetchColumn()
to get the return from the select statement
I am not sure what you want $returnResults to have in it but this might just be what I put in the $count variable
精彩评论