%26lt;?php
/* Program: mysql_up.php
* Desc: Connects to MySQL Server and
* outputs settings.
*/
echo %26quot;%26lt;html%26gt;
%26lt;head%26gt;%26lt;title%26gt;Test MySQL%26lt;/title%26gt;%26lt;/head%26gt;
%26lt;body%26gt;%26quot;;
$host=%26quot;%26quot;;
$user=%26quot;%26quot;;
$password=%26quot;%26quot;;
$cxn = mysqli_connect($host,$user,$password);
$sql=%26quot;SHOW STATUS%26quot;;
$result = mysqli_query($cxn,$sql);
if($result == false)
{
echo %26quot;%26lt;h4%26gt;Error: %26quot;.mysqli_error($cxn).%26quot;%26lt;/h4%26gt;%26quot;;
}
else
{
/* Table that displays the results */
echo %26quot;%26lt;table border=%26#039;1%26#039;%26gt;
%26lt;tr%26gt;%26lt;th%26gt;Variable_name%26lt;/th%26gt;
%26lt;th%26gt;Value%26lt;/th%26gt;%26lt;/tr%26gt;%26quot;;
for($i = 0; $i %26lt; mysqli_num_rows($result); $i++)
{
echo %26quot;%26lt;tr%26gt;%26quot;;
$row_array = mysqli_fetch_row($result);
for($j = 0;$j %26lt; mysqli_num_fields($result);$j++)
{
echo %26quot;%26lt;td%26gt;%26quot;.$row_array[$j].%26quot;%26lt;/td%26gt;\n%26quot;;
}
}
echo %26quot;%26lt;/table%26gt;%26quot;;
}
?%26gt;
%26lt;/body%26gt;%26lt;/html%26gt;
The code above is not working properly. The web page shows up blank. It%26#039;s suppose to show a table. can anyone help?
I have the following code. It%26#039;s suppose to display a table to show the connection beteween my webiste and SQL
The part near the beginning of the file:
$host=%26quot;%26quot;;
$user=%26quot;%26quot;;
$password=%26quot;%26quot;;
Need to be filled in. Your script needs to know where SQL is located, and how to log in.
No comments:
Post a Comment