0

Hi Friends

I am facing an issue in update query using PDO Prepare method. Please help me to fix the issue.

$consql = "UPDATE $database.$constant_application SET SCYQ64EMAL=:SCYQ64EMAL, SCYQ64EV01=:SCYQ64EV01, SCYQ64EV02=:SCYQ64EV02, 
        SCYQ64EV03=:SCYQ64EV03,SCYQ64EV04=:SCYQ64EV04, SCYQ64EV05=:SCYQ64EV05, SCYQ64EV06=:SCYQ64EV06, SCUSER=:SCUSER, SCJOBN=:SCJOBN, SCPID=:SCPID, SCYQ64AVGP=:SCYQ64AVGP, SCYQ64TZ=:SCYQ64TZ, SCUPMJ=:SCUPMJ, SCUPMT=:SCUPMT where SCYQ64CID=:SCYQ64CID";
    $row = $dbh->prepare($consql);
    $row->bindParam(":SCYQ64EMAL",$SCYQ64EMAL);
    $row->bindParam(":SCYQ64EV01",$SCYQ64EV01);
    $row->bindParam(":SCYQ64EV02",$SCYQ64EV02);
    $row->bindParam(":SCYQ64EV03",$SCYQ64EV03);
    $row->bindParam(":SCYQ64EV04",$SCYQ64EV04);
    $row->bindParam(":SCYQ64EV05",$SCYQ64EV05);
    $row->bindParam(":SCYQ64EV06",$SCYQ64EV06);
    $row->bindParam(":SCUSER",$SCUSER);
    $row->bindParam(":SCJOBN",$SCJOBN);
    $row->bindParam(":SCPID",$SCPID);
    $row->bindParam(":SCYQ64AVGP",$SCYQ64AVGP);
    $row->bindParam(":SCYQ64TZ",$SCYQ64TZ);
    $row->bindParam(":SCUPMJ",$SCUPMJ);
    $row->bindParam(":SCUPMT",$SCUPMT);
    $row->bindParam(":SCYQ64CID",$SCYQ64CID);
3
Contributors
3
Replies
18
Views
2 Years
Discussion Span
Last Post by diafol
0

I am facing an issue

What's the issue? Am guessing the colons before your parameter names in bindParam...

Edited by pritaeas

0

Have you executed it?

echo the prepared statement to ensure that the embedded variables are as you expect

With bindParam (from manual):

e.g.

$sth->bindParam(':calories', $calories, PDO::PARAM_INT);

You can add datatype. If you're not using this, then you may as well do:

$consql = "UPDATE $database.$constant_application SET SCYQ64EMAL=?, SCYQ64EV01=?, SCYQ64EV02=?, SCYQ64EV03=?,SCYQ64EV04=?, SCYQ64EV05=?, SCYQ64EV06=?, SCUSER=?, SCJOBN=?, SCPID=?, SCYQ64AVGP=?, SCYQ64TZ=?, SCUPMJ=?, SCUPMT=? where SCYQ64CID=?";
$row = $dbh->prepare($consql);
$values = array($SCYQ64EMAL,$SCYQ64EV01,$SCYQ64EV02,$SCYQ64EV03,$SCYQ64EV04,$SCYQ64EV05,$SCYQ64EV06,$SCUSER,$SCJOBN,$SCPID,$SCYQ64AVGP,$SCYQ64TZ,$SCUPMJ,$SCUPMT,$SCYQ64CID);
$row->execute($values);

Edited by diafol

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.