Welcome our webmaster and SEO forum
Please enjoy the forum, contribute what you can, and wind up the Moderators!
Closed Thread
Results 1 to 6 of 6

Thread: Connecting to MySQL. Blank Screen :(

  1. #1
    seb_ Guest

    Default Connecting to MySQL. Blank Screen :(

    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:
    <?php
    mysql_connect('localhost','USERNAME','PASSWORD');
    mysql_select_db('test');

    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:
    <html>
    <head><title>Test MySQL</title></head>
    <body>
    <!-- mysql_up.php -->
    <?php
    $host="localhost";
    $user="USERNAME";
    $password="PASSWORD";

    mysql_connect($host,$user,$password);
    $sql="show status";
    $result = mysql_query($sql);
    if ($result == 0)
    echo "<b>Error " . mysql_errno() . ": "
    . mysql_error() . "</b>";
    else
    {
    ?>
    <!-- Table that displays the results -->
    <table border="1">
    <tr><td><b>Variable_name</b></td><td><b>Value</b>
    </td></tr>
    <?php
    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>";
    }
    ?>
    </table>
    <?php } ?>
    </body></html>


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

    Any help would be greatly apprieciated, thank you.

  2. #2
    imported_misi Guest

    Default

    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_received426 Bytes_sent1304890Com_admin_commands0 ...
    ..
    .

    Misi

  3. #3
    crowebird is offline Senior Member crowebird is on a distinguished road
    Join Date
    Aug 2004
    Posts
    263

    Default

    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. #4
    martian2k4 Guest

    Default

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

    <?php
    mysql_connect("localhost","username","password");
    mysql_select_db("db_name");
    ?>

    Just a bit shorter than the way you do it

  5. #5
    martian2k4 Guest

    Default

    Quote Originally Posted by seb_
    PHP Code:
    <?php
    mysql_connect('localhost','USERNAME','PASSWORD');
    mysql_select_db('test');

    echo 'unless you see any error messages, everything should be fine';
    ?>
    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. #6
    seb_ Guest

    Default

    Hey,
    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.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. AdminPanel is blank
    By isais in forum Boss Cart Installation Help
    Replies: 1
    Last Post: 10-10-2007, 10:37 AM
  2. SQL ERROR: MySQL connection failed (velnet.driver.mysql) not persistent
    By Piotrek in forum Boss Cart Installation Help
    Replies: 5
    Last Post: 06-02-2006, 08:59 PM
  3. Replies: 0
    Last Post: 02-12-2004, 08:31 PM
  4. Blank Page
    By rabshire in forum iG Shop
    Replies: 6
    Last Post: 08-21-2003, 08:41 AM
  5. blank page
    By AL!x in forum iG Shop
    Replies: 2
    Last Post: 08-21-2003, 08:36 AM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124