For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > October 2005 > Php 5.0.5 and Mysql 5.0.12 failure on accessing database.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Php 5.0.5 and Mysql 5.0.12 failure on accessing database.
Blake Friedman

2005-10-23, 6:56 pm

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 =3D 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 passwor=
d :P)

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

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

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

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







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com