The Host, Username and Database name all seem to be correct.
After I go through the connect procedure to the database
This is my code:
All I want to do at this time is to query the db so I can read the files I have already added using the tools TCM provides
Here is my query code:
I first define the DB_HOST, DB_USER,, DB_PASSWORD, and the DB_NAME.
Then my code continues as:
$dbh=mysql_connect (DB_HOST, DB_USER, DB_PASSWORD) or die ('I cannot connect to the database because: ' . mysql_error());
@mysql_select_db (DB_NAME) or die ('I cannot connect to the database because: ' . mysql_error());
echo "Database is (DB_NAME) and has connected properly: <p>";
$query ="SELECT * FROM dbase22 LIMIT 0, 30" ;
$result = mysql_query($query ) or die ('I cannot read the database because: ' . mysql_error());
echo "$result <br>" ;
echo " . . . were the results of this show query <br><br><br>";
echo " <br><br> $query ";
echo '<table align="center" cellspacing="2" cellpadding="2"> <tr> <td align="left"><b>CALLSIGN</b></td><td align="left"><b>NAME</b></td><td align="left"><b>EMAIL</b> </td> </tr>';
// Fetch the records.
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
echo" <tr><td align = \"left\">
$row[0]</td><td align = \"left\">
$row[1]</td> <td align = \"left\">
$row[2]</td></tr> \n";
}
echo '</table>';
mysql_free_result($result);
}else{
echo'<p> no info due to a system error</p> <p>'. mysql_error().'</p>';
}
mysql_close();
Ok So where did I go wrong?