mercredi 18 novembre 2020

pdo double statement not updating the database

Actually it save some data but not all I dont know if its my database statement who is'nt right or its my script not working well. why it does'nt save the pictures in database?

// updating the database
            $statement = $pdo->prepare("UPDATE tbl_advertisement SET  adv_edition=?, adv_prochain=?, adv_url=?, adv_status=? WHERE adv_id=2");
            $statement->execute(array($_POST['adv_edition'],$_POST['adv_prochain'],$_POST['adv_url'],$_POST['adv_status']));
        } else {
             
             unlink('../Archives/pdfimages/'.$_POST['edition_photo']);

            // updating the database
 
            $statement = $pdo->prepare("UPDATE tbl_advertisement SET adv_photo=?, adv_url=?, adv_status=? WHERE adv_id=2");
            $statement->execute(array($name,$_POST['adv_url'],$_POST['adv_status']));
        }

        $success_message = 'Advertisement is updated successfully.';
    }
}

The first statement work but not the second!!!

Aucun commentaire:

Enregistrer un commentaire