Dismiss Notice
Welcome to Our Community
Wanting to join the rest of our members? Feel free to sign up today.

Connecting to MySQL. Blank Screen :(

Discussion in 'General Webmaster Helpdesk' started by seb_, Apr 6, 2005.

  1. seb_

    seb_ Guest

    I'm haveing some problems installin PHP and MySQL on PWS.
    I have instaled PHP and that seems to be working fine (i checkd it with phpinfo() ) but when I run a file to test MySQL I get a blanck screen.

    First I tried this:

    PHP Code:

    echo 'unless you see any error messages, everything should be fine';

    I then went to the mysql and php for dummies website and tried this;
    PHP Code:
    <head><title>Test MySQL</title></head>
    <!-- mysql_up.php -->

    $sql="show status";
    $result = mysql_query($sql);
    if ($result == 0)
    echo "<b>Error " . mysql_errno() . ": "
    . mysql_error() . "</b>";
    <!-- Table that displays the results -->
    <table border="1">
    for ($i = 0; $i < mysql_num_rows($result); $i++) {
    echo "<TR>";
    $row_array = mysql_fetch_row($result);
    for ($j = 0; $j < mysql_num_fields($result); $j++)
    echo "<TD>" . $row_array[$j] . "</td>";
    echo "</tr>";
    <?php } ?>

    I am using MySQL 4, PHP 5 and Personal Web Server on Win98

    Any help would be greatly apprieciated, thank you.
  2. Hi,

    Please make sure that the MySql is started and if the username and password what you use is okay.

    Also when you run the test and see the blank page, on the browser window please right mouse click and click to "View Source". On the opened source code please check if you see php/mysql code, if yes the php or the http server not working okay.

    Booth code what you tried to use is okay.

    Fir the first code you need to get the result:

    "unless you see any error messages, everything should be fine"

    For the second:

    Variable_nameValue Aborted_clients2Aborted_connects1Bytes_received426Bytes_sent1304890Com_admin_commands0 ...

  3. crowebird

    crowebird New Member Webmaster

    when I do my connect and querys I write it like this

    $DBhost = "";
    $DBuser = "";
    $DBpass = "";
    $DBname01 = "";
    $table01 = "";

    $DBconnect = @mysql_connect($DBhost,$DBuser,$DBpass);
    $DBselecDB = @mysql_select_db($DBname01, $DBconnect);
    $sql = "SELECT * FROM $table01 ... ";
    $result = @mysql_query($sql, $DBconnect);
  4. martian2k4

    martian2k4 Guest

    Whoa you loat do it really long, normally i just put


    Just a bit shorter than the way you do it
  5. martian2k4

    martian2k4 Guest

    Oh btw with that ^^ You will not get any errors appearing, to get it to show the error you would have to add

    mysql_connect('localhost','USERNAME','PASSWORD') or die ('There was a error, ' . mysql_error());

  6. seb_

    seb_ Guest

    Thanks for the replys! The source code only shows HTML as the server is fine and so is the PHP. PHPinfo isnt showing the MySQL module so I havent installed it right does any know where I can get a step by step guide to doing this as looking through the net has really confused me.
    I have removed everything including my server and am going to reinstall tomorrow so i'm all fresh again. I might jus give up and download XAMP or TRIAD or summin but I really dnt wanna. :(

Featured Resources (View All)

Share This Page