I see Part 4 - Displaying Data and decide to give their code a test drive. I get error messages that I do not even want to go into so I am going to install PHPMyAdmin instead.
Must...procrastinate.....longer.
PHPMyAdmin is an administrative tool that makes handling MySQL easier.
After downloading PHPMyAdmin I unzipped the contents into c:/myserver and entered http://localhost/phpMyAdmin-2.10.1-all-languages-utf-8-only/scripts/setup.php in my web browser.
Look at all these wonderful toys.
So after going through Servers and adding my own with info I found on <?php phpinfo(); ?> I went back to the drawing board and started echoing examples from the official PHP Manual. I have been able to connect to MySQL with the following code which I derived from their section on mysql_connect()
<?php
//Example 1352. mysql_connect() example
//http://us.php.net/manual/en/function.mysql-connect.php
$user = "root";
$password= "*****";
$link = mysql_connect('localhost', $user, $password);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
I am able to manipulate databases using PHPMyAdmin. Unfortunately, I still can't create a database using PHP. At least I know it is possible to connect.
So after going through Servers and adding my own with info I found on <?php phpinfo(); ?> I went back to the drawing board and started echoing examples from the official PHP Manual. I have been able to connect to MySQL with the following code which I derived from their section on mysql_connect()
<?php
//Example 1352. mysql_connect() example
//http://us.php.net/manual/en/function.mysql-connect.php
$user = "root";
$password= "*****";
$link = mysql_connect('localhost', $user, $password);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
I am able to manipulate databases using PHPMyAdmin. Unfortunately, I still can't create a database using PHP. At least I know it is possible to connect.
No comments:
Post a Comment