Php 5.0.5 and Mysql 5.0.12 failure on accessing database.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

Apologies, I'm a noob so plz bear with me :).

In attempting to get TorrertFlux, a php bittorrent manager, working I
came across a significant problem: the php content be displayed.

After further investigation it became apparent that this was mysql
related, so I hacked together a quick script to see what was happening
and found the following:

When using:
  @mysql_select_db("sample"), instead of
  $test = mysql_select_db("sample", &dbConnect)

the same problem of the php page not loading would occur.

Does anyone have any idea my this is occurring?

I'm running Php 5.0.5, Mysql 5.0.12, Apache 1.3.33 on FreeBSD 5.4-Stable.

Thanks
Blake

I've attached a copy of the script for clarity (changed usrname and password :P)

<?PHP
        echo ("<p>Starting database stuff:</p>");
        $dbConnect = mysql_connect ("localhost", "abc", "xyz");
        if (!$dbConnect) {
                echo ("<p>Unable to connect to database.</p>");
                exit();
        }
        else
                echo ("<p> Connected </p>");

        $test = mysql_select_db("sample", $dbConnect);
        if (!$test) {
                echo ("<p>Unable to to select table.</p>");
                exit();
        }

        $sql = "SELECT * FROM names";
        $result = @mysql_query($sql);

        while ($row = mysql_fetch_array($result)) {
                echo ("<p>" . $row["name"] . " - " . $row["age"] . "</p>");
        }
        echo ("<p>Closing database stuff:</p>");
?>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux