samedi 2 décembre 2017

How I can return the updated row ID in the given code

This code is working fine for updating the row , but I want to RETURN the updated Row ID. Please let me know how I can do that.

static function editProject($arr)
{
    foreach ($arr as $key => $value) {
        $$key = $value;
    }
    $db = new DatabaseConnection();
    $dbh = $db->getDBH();
    $sql = "UPDATE Project SET Job_Name='$JobName',Job_Number='$JobNumber',Location='$Location',
            Project_SupervisorID='$ProjectSupervisorID',Project_ManagerID='$ProjectManagerID',Notes='$Notes',Category='$Category'
            WHERE ID='$ID'";
    $pdo = $dbh->query($sql);
    $db->disconnect();
    return $pdo->rowCount(); // INSTEAD of ROW COUNT RETURN I WANT TO RETURN ID here
 }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire