Hi there,
I wasn't sure where to put this question, since it deals with both PHP and MySQL. I apologize if this is not the correct forum for this.
I am working with a simple PHP application using MySQL at the data layer.
This is on a Windows XP machine, using IIS 6.0, MySQL 5.0, PHP 5.
The problem I am having is that a call to mysql_connect is not working, it is not doing anything at all. I'm not getting any error messages, or warnings, or a whistle, or whatever. It just does nothing at all.
This is the script:
[PHP]<?php
$dbConn = mysql_connect(' 127.0.0.1', 'root', 'thepassword') or die('Could not connect: ' . mysql_error());
echo "HURRAY! mysql_connect works!<br>"; // this line never gets displayed on the page
if (!$dbConn)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db ("mydb", $dbConn);
$sql="SELECT * FROM levels";
$result = mysql_query($sq l);
echo "<table border='1'>
<tr>
<th>levelname </th>
<th>mingamespla yed</th>
<th>mingameswon </th>
</tr>";
while($row = mysql_fetch_arr ay($result))
{
echo "<tr>";
echo "<td>" . $row['levelname'] . "</td>";
echo "<td>" . $row['mingamesplayed '] . "</td>";
echo "<td>" . $row['mingameswon'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($db Conn);
?>[/PHP]
I put the line that says [PHP]echo "HURRAY! mysql_connect works!<br>";[/PHP] as a reachmark; however, it never gets displayed, and I am not getting the data requested. All I get is a blank page. I even put a wrong host, username and password to provoke an error, and I don't EVEN get an error.
MySQL is working. I have created, populated and retrieved data using the tools provided by MySQL. I have created other PHP pages --not using MySQL calls-- and they work just fine.
I have tried whatever I have read throughout the internet with not success. I have checked the php.ini file for the extensions and extensions_dir, and the place where the libmysql.dll and the php_mysqli.dll should be, etc, etc, etc. But I get nothing, nothing at all.
I think here's all the info, but if you need something else to help me out, let me know to give you that extra info. You can ask me anything, even if I have tried it, so just in case whatever I have tried I have done it incorrectly.
Please help, and thanks in advance.
C
I wasn't sure where to put this question, since it deals with both PHP and MySQL. I apologize if this is not the correct forum for this.
I am working with a simple PHP application using MySQL at the data layer.
This is on a Windows XP machine, using IIS 6.0, MySQL 5.0, PHP 5.
The problem I am having is that a call to mysql_connect is not working, it is not doing anything at all. I'm not getting any error messages, or warnings, or a whistle, or whatever. It just does nothing at all.
This is the script:
[PHP]<?php
$dbConn = mysql_connect(' 127.0.0.1', 'root', 'thepassword') or die('Could not connect: ' . mysql_error());
echo "HURRAY! mysql_connect works!<br>"; // this line never gets displayed on the page
if (!$dbConn)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db ("mydb", $dbConn);
$sql="SELECT * FROM levels";
$result = mysql_query($sq l);
echo "<table border='1'>
<tr>
<th>levelname </th>
<th>mingamespla yed</th>
<th>mingameswon </th>
</tr>";
while($row = mysql_fetch_arr ay($result))
{
echo "<tr>";
echo "<td>" . $row['levelname'] . "</td>";
echo "<td>" . $row['mingamesplayed '] . "</td>";
echo "<td>" . $row['mingameswon'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($db Conn);
?>[/PHP]
I put the line that says [PHP]echo "HURRAY! mysql_connect works!<br>";[/PHP] as a reachmark; however, it never gets displayed, and I am not getting the data requested. All I get is a blank page. I even put a wrong host, username and password to provoke an error, and I don't EVEN get an error.
MySQL is working. I have created, populated and retrieved data using the tools provided by MySQL. I have created other PHP pages --not using MySQL calls-- and they work just fine.
I have tried whatever I have read throughout the internet with not success. I have checked the php.ini file for the extensions and extensions_dir, and the place where the libmysql.dll and the php_mysqli.dll should be, etc, etc, etc. But I get nothing, nothing at all.
I think here's all the info, but if you need something else to help me out, let me know to give you that extra info. You can ask me anything, even if I have tried it, so just in case whatever I have tried I have done it incorrectly.
Please help, and thanks in advance.
C
Comment