Hi ! I'm using PHP 5.1.2 and MySQL 5.0 . When I use mysql_connect("localhost","root","sa") function (sa is my password to connect to MySQL) and other functions to show a table in a data I created on webpage ,but it display a blank page .I checked very carefully functions i used.I copied even source code from an ebook ,but It also display an blank page.I tested many times I'm very disheartened . Please help me !.
If you post the source code, it may be easier to help you out. You can view this thread for a little function I wrote to do this. You will have to change your values in the mysql_connect and select_db functions.
<HTML> <HEAD> <TITLE> Displaying tables with MySQL </TITLE> </HEAD> <BODY> <CENTER> <H1>Displaying tables with MySQL</H1> <?php $connection = mysql_connect("localhost","root","abc") or die ("Couldn't connect to server"); $db = mysql_select_db("produce", $connection) or die ("Couldn't select database"); $query = "SELECT * FROM fruit"; $result = mysql_query($query) or die("Query failed: ".mysql_error()); echo "<TABLE BORDER='1'>"; echo "<TR>"; echo "<TH>Name</TH><TH>Number</TH>"; echo "</TR>"; while ($row = mysql_fetch_array($result)) { echo "<TR>"; echo "<TD>", $row['name'], "</TD><TD>", $row['number'], "</TD>"; echo "</TR>"; } echo "</TABLE>"; mysql_close($connection); ?> </CENTER> </BODY> </HTML>
Yeah, I agree, that code seems to work fine for me. I changed the query to work in my database, but that's it. You're not getting MySQL Errors? Just a blank page?
After installing PHP ,I tested with phpinfo(); function.I installed PHP successfully .I uncommented extension hp_mysql.dll,v.v...