PDA

View Full Version : Mysql is it connecting, I can't tell?


rd42
10-2-03, 11:59 PM
I'm new to using Powweb for mysql and php. I created a sample script to connect to the db and puke out some data.

The db is called assets, and contains a table accounts that has plenty of information contained with in.

I run the code below, and I get nothing out, no errors, and not even the "i'm in the while loop" quote.

What am I missing besides sweet sweet shell access?

<HTML>
<BODY>
<?php

$db = mysql_connect("mysql0x.powweb.com","xxxx","xxxxxxxxx","assets");

mysql_select_db("accounts",$db);

$hyper = mysql_query("SELECT * FROM accounts", $db);

while ($myrow = mysql_fetch_array($hyper))
{
echo $myrow["accid"];
echo "in the while loop";
echo $myrow["account"];
echo $myrow["phone"];
echo $myrow["contact"];
echo $myrow["cphone"];
}
?>

</BODY>
</HTML>

rd42
10-3-03, 12:05 AM
My problem was that I was including the db name within the connect command.

BEFORE:
$db = mysql_connect("mysql0x.powweb.com","xxxx","xxxxxxxxx","assets");
mysql_select_db("accounts",$db);

AFTER:
$db = mysql_connect("mysql0X.powweb.com","XXXXXX","XXXX");
mysql_select_db("assets",$db);