I am trying to connect to MySQL database and I am wondering how I can report back something so I know I am really connected.
I am using the following as a test file:
<?php
session_start();
//create short variable names
$username ="Conjurer";
$passwd = "XXXXXX";
// include function files for this application
//require_once('includes/member_fns.php5');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Test for OMGMA Connection</title>
</head>
<body>
<?php
echo "<p>User: $username - Password: $passwd </p>";
echo "<p>Attempting to connect to database</p>";
function db_connect()
{
$result = new mysqli('localhost', 'omgma_members', 'YYYYYYYY', 'omgma_members');
if (!$result)
throw new Exception ('db_connect cound not connect to database');
else
return (int)$result;
}
echo "result: $result";
?>
</body>
</html>
When I load the file from my website I get the following:
User: Conjurer - Password: XXXXXX
Attempting to connect to database
result: