Dbdocs

No Category Code Examples Test Code Web Link Remarks
 1 Useful Links MySql Home http://www.mysql.com/
 2 Sampe Code <?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(); } ?>
 3 Replace How to Find & Replace Data in MySQL To find a string in a certain field and replace it with another string: update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]');