I am firing a update query. Its working for one page and not working on other one. Can anybody take a look. thanks
<br />
<b>Fatal error</b>: Uncaught exception 'Doctrine_Connection_Mysql_Exception' with message
'SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens' in
C:\xampp\htdocs\fanyer\doctrine\lib\Doctrine\Connection.php:1084Stack trace:
#0 C:\xampp\htdocs\fanyer\doctrine\lib\Doctrine\Connection\Statement.php(253):
Doctrine_Connection->rethrowException(Object(PDOException),
Object(Doctrine_Connection_Statement))
#1 C:\xampp\htdocs\fanyer\doctrine\lib\Doctrine\Connection.php(1049):
Doctrine_Connection_Statement->execute(Array)
#2 C:\xampp\htdocs\fanyer\doctrine\lib\Doctrine\Query\Abstract.php(1091):
Doctrine_Connection->exec('UPDATE users SE...', Array)
#3 C:\xampp\htdocs\fanyer\doctrine\lib\Doctrine\Query\Abstract.php(1142):
Doctrine_Query_Abstract->_execute(Array)
#4 C:\xampp\htdocs\fanyer\doctrine\models\Users.php(122): Doctrine_Query_Abstract-
>execute()
#5 C:\xampp\htdocs\fanyer\include\update_profile.inc.php(18): Users-
>update_coach_details('', '', NULL, 'Select', 'dav', 'coach', '3')
#6 { in <b>C:\xampp\htdocs\fanyer\doctrine\lib\Doctrine\Connection.php</b> on line
<b>1084</b><br />
EDIT: I am not able to identify where is the problem in parameter passing.. please take a look..
public function update_coach_details($fname,$lname,$city,$state,$school,$rights,$user_id)
{
return Doctrine_Query::create()
->update('Users')
->set('f_name', '?', $fname)
->set('l_name', '?', $lname)
->set('city', '?', $city)
->set('state', '?', $state)
->set('school', '?', $school)
->set('rights', '?', $rights)
->where("id = '$user_id'")
->execute();
}
$account_type=$_SESSION['rights'];
$fname= $_POST['fname'];
$lname= $_POST['lname'];
$state= $_POST['state'];
$school= $_POST['school'];
$sports= $_POST['sports'];
$sports_array = explode(',',$sports);
$user_id=$_SESSION['user_id'];
$users= new Users();
$users->update_coach_details($fname,$lname,$city,$state,$school,$account_type,$user_id);