-
December 13th, 2007, 01:01 AM
#1
PHP - SQL problem
I have been working on a website recently that needs to contain databases with things like emails (used as user name), passwords, and other information on the user. The problem I have been having is accessing the database using PHP. When I view this file in my browser, it only shows "connecting..." and doesn't continue with anything. I called the tech support, and that is the information they said to use, but its not working. I figured even if the information wasn't correct, it should go to the IF statement that displays an error, but that doesn't happen. Here is code that I have attempted to use to connect to the database. The domain is registered with Register.com if that helps. As you can tell, I am very new to PHP and SQL, so any help would be greatly appreciated.
Code:
<?php
/* Program: mysql_up.php
* Desc: Connects to MySQL Server and
* outputs settings.
*/
echo "<html>
<head><title>Test MySQL</title></head>
<body>";
$host="sql5c6a.megasqlservers.com";
$user="dbm.restoretraditionalamerica.com";
$password="*";
echo "connecting...";
$cxn = mysqli_connect($host,$user,$password);
echo "connected";
$sql="SHOW STATUS";
$result = mysqli_query($cxn,$sql);
if($result == false)
{
echo "<h4>Error: ".mysqli_error($cxn)."</h4>";
}
else
{
/* Table that displays the results */
echo "<table border='1'>
<tr><th>Variable_name</th>
<th>Value</th></tr>";
for($i = 0; $i < mysqli_num_rows($result); $i++)
{
echo "<tr>";
$row_array = mysqli_fetch_row($result);
for($j = 0;$j < mysqli_num_fields($result);$j++)
{
echo "<td>".$row_array[$j]."</td>\n";
}
}
echo "</table>";
}
?>
</body></html>
Similar Threads
-
By catch in forum The Security Tutorials Forum
Replies: 27
Last Post: August 9th, 2006, 08:01 AM
-
By nightcat in forum The Security Tutorials Forum
Replies: 9
Last Post: May 28th, 2005, 02:47 AM
-
By HDD in forum Other Tutorials Forum
Replies: 2
Last Post: February 1st, 2004, 08:05 PM
-
By mantra in forum AntiOnline's General Chit Chat
Replies: 6
Last Post: January 6th, 2003, 09:18 AM
-
By yuna_admirer in forum Programming Security
Replies: 4
Last Post: December 14th, 2002, 03:19 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|