comboy
Instructor
- May 23, 2003
- 226
Hi all,
I'm new to web development but I've set up apache 2.x MySQL 5.x and PHP5 on XP home.
When I use a phpinfo() script it shows up on the local host and seems that every thing is ok.
However when I try and connect to MySQL using the code below I just get a blank page with no warnings etc
when configuring php I've done the following
1. created a new text file and copied the contents of php.ini-recommended to it and saved it as php.ini
2. added LoadModule php5_module "c:/php/php5apache2.dll" to the httpd.conf
3. added AddType application/x-httpd-php .php .html to the httpd.conf
4. added PHPIniDir "c:/php" to the httpd.conf
5. Added ;C:\php to the Windows systems PATH
Have I missed anything and any ideas why I'm just getting a blank page?
Any help greatly appreciated
Graham.
I'm new to web development but I've set up apache 2.x MySQL 5.x and PHP5 on XP home.
When I use a phpinfo() script it shows up on the local host and seems that every thing is ok.
However when I try and connect to MySQL using the code below I just get a blank page with no warnings etc
Code:
<?php
// Connecting, selecting database
$link = mysql_connect('localhost', 'joeuser', 'pass')
or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db('testDB') or die('Could not select database');
// Performing SQL query
$query = 'SELECT * FROM test';
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
// Printing results in HTML
echo "<table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td>$col_value</td>\n";
}
echo "\t</tr>\n";
}
echo "</table>\n";
// Free resultset
mysql_free_result($result);
// Closing connection
mysql_close($link);
?>
when configuring php I've done the following
1. created a new text file and copied the contents of php.ini-recommended to it and saved it as php.ini
2. added LoadModule php5_module "c:/php/php5apache2.dll" to the httpd.conf
3. added AddType application/x-httpd-php .php .html to the httpd.conf
4. added PHPIniDir "c:/php" to the httpd.conf
5. Added ;C:\php to the Windows systems PATH
Have I missed anything and any ideas why I'm just getting a blank page?
Any help greatly appreciated
Graham.