Example of using PHP PDO

Welcome to the first Tutorial about PHP and the PDO database interface.

Here is some code using PDO for simple data fetching:

exec("INSERT INTO table_name (colum1,colum2)
                 values ('content for colum 1','content for colum 2')");
#the query for the result display
$sql = 'SELECT colum1,colum2 FROM table_name ORDER BY colum1';
# go trough each row of the query
foreach ($database->query($sql) as $row) {
        # display the content of the rows
        print $row['colum1'] . ' | ';
        print $row['colum2'] . PHP_EOL;
}
?>

This should get you started on using PDO. If you have any questions please use the comments.