DROP Query using PDO

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

Here is an example.
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.

Visitors Rating
Your Rating





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 .




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