Re: How do configure PHP support for MySQL on Windows?
| From: | Sean B. Durkin | Date: | Mon, 23 Jul 2007 22:53:56 +0000 |
| Subject: | Re: How do configure PHP support for MySQL on Windows? | ||
| References: | 1 2 3 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-28232@lists.php.net to get a copy of this message | ||
Niel,
Thanks for your advise. I have tested the Apache web server, and it is working fine. I have tested MySQL through a console window, and used it
to create a database, and it is working fine. I have tested PHP on
Apache by viewing php pages, and it is working fine.
However if I use a php script to call any php mysql database functions,
then parsing bombs out without returning an error message. For example,
the following script returns an blank page to the browser. There is not
even an error message.
The following code is from Kevin Yank's book "Build Your Own Database Driven Web-site using PHP and MySQL".
================================================
<html>
<head>
<title>Our List of Jokes</title>
<meta http-equiv="content-type"
content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php
// Connect to the database server
$dbcnx = @mysql_connect('localhost', 'root', 'mypasswd');
if (!$dbcnx) {
exit('<p>Unable to connect to the ' .
'database server at this time.</p>');
}
// Select the jokes database
if (!@mysql_select_db('ijdb')) {
exit('<p>Unable to locate the joke ' .
'database at this time.</p>');
}
?>
<p>Here are all the jokes in our database:</p>
<blockquote>
<?php
// Request the text of all the jokes
$result = @mysql_query('SELECT joketext FROM joke');
if (!$result) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
// Display the text of each joke in a paragraph
while ($row = mysql_fetch_array($result)) {
echo '<p>' . $row['joketext'] . '</p>';
}
?>
</blockquote>
</body>
</html>
================================================
I have followed Kevin Yank's book, which is a step-by-step
guide.
Any ideas anyone?
Faithfully,
Sean B. Durkin
Niel Archer wrote:
HiThe MySQL is started. I have only one php.ini and it is in the correct location.That statement is only true, provided your not working under a misconception, the usual cause of problems. Your initial post told us very little useful info, just that you'd install this, that and the other. Did you test each component along the way to ensure it was working? If so, what errors does PHP give when attempting to use a MySQl db? You might try looking at this step by step guide also to see if you missed anything http://wamp.corephp.co.uk/ -- Niel Archer