Dbdocs 2

CategorySampe Code
Code Examples<?php $dbhost = 'localhost'; $user = 'root'; $pass = 'passwd'; $dbname = 'mydb'; try { $dbh = new PDO("mysql:host=localhost;dbname=mydb", $user, $pass); $sql = explode(';', file_get_contents('./final.sql')); $n = 0; foreach ($sql as $row) { $query = $row; echo $query; $dbh->query($query); $n++; print "$n\n"; } $dbh = null; } catch (PDOException $e) { print "Error!: " . $e->getMessage() . "
"; die(); } ?>
Test Code
Web Link
Remarks
Cancel