Broad Network


Example
The following code should read rows from a table in a MySQL database, or inform you that the MySQL server does not support SSL:


<?php

require_once("./Mysql.php");

        if (!connect("root", "secret", "localhost", 3306, undef, 'ssl', '/etc/ssl/ca.pem', 'cert.pem', 'key.pem'))
            {
                echo "$Error_msg";
            }
        else
            {
                if (!select_db("PetStore"))
                    {
                        echo $Error_msg, "<br>";
                    }
                else   
                    {
                        $sel = "SELECT * FROM pet";
                        if (query($sel) !== true)
                            {
                                echo $Error_msg, "<br>";
                            }
                        else
                            {
                                for ($i=0; $i<$No_of_Rows; ++$i)
                                    {
                                       echo $Result[$i]['name'],  ', ';
                                       echo $Result[$i]['owner'],  ', ';
                                       echo $Result[$i]['species'],  ', ';
                                       echo $Result[$i]['sex'],  ', ';
                                       echo $Result[$i]['birth'],  ', ';
                                       echo $Result[$i]['death'],  ', ';
                                       echo "<br>";        
                                    }
                            }
                    }
            }

         close();

?>

That is it for this part of the series. We stop here and continue in the next part.

Chrys

Related Links

Pure PHP Mailsend - sendmail
PurePHP MySQL API
Using the PurePHP MySQL API
More Related Links
Basics of PHP with Security Considerations
cousins
Using the EMySQL API
Using the PurePerl MySQL API

BACK NEXT

Comments

Become the Writer's Follower
Send the Writer a Message