Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
prepare("UPDATE tb set fname=:fname, sname=:sname, lname=:lname, pNo=:pNo, mNo=:mNo, Entry=:Entry, Faculty=:Faculty, Department=:Department, Session_Year:Session_Year, mstatus=:mstatus, gender=:gender, dob=:dob, State=:State, lga=:lga, Address=:Address where pNo= $pNo");
$stmt->bindParam("fname",$fname);
$stmt->bindParam("sname",$sname);
$stmt->bindParam("lname",$lname);
$stmt->bindParam("pNo",$pNo);
$stmt->bindParam("mNo",$mNo);
$stmt->bindParam("Entry",$Entry);
$stmt->bindParam("Faculty",$Faculty);
$stmt->bindParam("Department",$Department);
$stmt->bindParam("Session_Year",$Session_Year);
$stmt->bindParam("mstatus",$mstatus);
$stmt->bindParam("gender",$gender);
$stmt->bindParam("dob",$dob);
$stmt->bindParam("State",$State);
$stmt->bindParam("lga",$lga);
$stmt->bindParam("Address",$Address);
$stmt->execute();
echo "alert('Update Succesfully');";

?>

What I have tried:

I'M try to update my record I'M Doing it Manually please if there is any solution
Posted
Updated 4-Jul-20 3:40am
Comments
Richard MacCutchan 4-Jul-20 5:55am    
I think you need to bind $pNo at the end, for the value in the WHERE clause.

1 solution

I see two issues:

1.
You have a typo (missing '=') in
Session_Year:Session_Year


2.
you shouldn't have a variable directly in your SQL statement ($pNo at the end).
You probably did try with one more parameter, but if you were using the same parameter name, that would fail as all parameter names (not the variables they are bound to) must be different. So you could choose a different parameter name.

But then, there is no need to "update" pNo anyway, as it already holds the right value due to your WHERE clause, so leave it out of the key-value pair list, and that problem no longer exists.

:)
 
Share this answer
 
v2
Comments
Ibrahim Hassan 1234 4-Jul-20 11:45am    
Thank You sir, im realy appreciate for ur quick responsed
Luc Pattyn 4-Jul-20 12:01pm    
you're welcome

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900