PDA

View Full Version : Powweb MySql Login


T33
10-14-07, 02:44 AM
I have been trying to run a simple query via a php script to show records in my MySql db on powwebs' server; however, I think there may be a problem with the php script (see below) because when it is executed to login to my DB it shows no messages just a blank web page. Can someone give me the sysntax needed at the start of my php script to login to my powweb database? Is there a simple php script I can use to test my connection to the database?

<? $hostname = "ammbc.powwebmysql.com"; // The Powweb DB server.
$username = "XXXXXX"; // The username you created for this database.
$password = "tYYYYY"; // The password you created for the username.
$usertable = "ZZZZZZ"; // The name of the table you made.
$dbName = "7777777"; // This is the name of the database you made.

MYSQL_CONNECT($hostname, $username, $password) OR DIE("DB connection unavailable");
@mysql_select_db( "$dbName") or die( "Unable to select database");
?>

entrecon
10-14-07, 09:01 PM
You don't have any select statements to choose something from the database and no print or echo commands to display data. You are probably connecting because if you were not you would get the die message.

HalfaBee
10-14-07, 09:39 PM
to display the info you need a few more lines (as mentioned)


$sql = "SELECT * from $usertable";
$result = mysql_query( $sql ) or die( mysql_error() );
while( $row = mysql_fetch_assoc( $result ) ) {
print_r( $row ); // show array details
}