DROP Query using PDO

PHP PDO & MYsQL We can drop or delete table from Database by using DROP query.


  • PDO: rowCount() with INSERT, DROP & DELETE query


Here is an example.
Database connection is available at config.php file.
require "config.php"; // database connection 
$sql=$dbo->prepare("DROP TABLE  student_del ");

$sql->execute();
After the query execution we will add message saying success or print error message in case of failure.
<?Php
require "config.php"; // database connection 
$sql=$dbo->prepare("DROP TABLE  student_del ");

if($sql->execute()){
echo " Table deleted ";
}else{
print_r($sql->errorInfo()); 
}
?>
In the above code we have used database connection code inside config.php file.
PDO ReferencesDelete Records


Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com







    aliko

    25-01-2016

    What about if I want to TRUNCATE A TABLE how would I do that? cheers
    smo1234

    25-01-2016

    Details about the TRUNCATE command is here.

    Post your comments , suggestion , error , requirements etc here





    PHP video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer