Friday, September 23, 2011

Workbench Scripts

A was checking out the new Workbench today after I saw this blog post

It all worked great and very easy.  Nice clean code that helps out the PHP Developer.

$con = new mysqli($host, $user, $password, $dbname, $port, $socket)
    or die ('Could not connect to the database server' . mysqli_connect_error());


$query = "SELECT * FROM exampledb";

if ($stmt = $con->prepare($query)) {
    $stmt->bind_result($field1, $field2);
    while ($stmt->fetch()) {
        //printf("%s, %s\n", $field1, $field2);

While this is a simple example it is a fantastic way for new developers to get started and learn how things are done.

A DBA can easily write a complex query and hand over PHP code to the developer. Nice work!

The ability to then write your own plugins really opens it up for some advanced developers. 

This is a step in the right direction and supports working together between DBA and developer.