Basically this is what I am trying to do:
I need to create a basic page that connects to a database and checks the date for a match, if the date matches, then I need it to display the text that goes along with it, other wise I need it to say a standard message. It's simple in theory and probably simple to code. It's been awhile since I've worked with this and am trying to brush up.
This is what I have so far, and know a few parts of it aren't right (just filled some things in, so they weren't blank).
<?php
// Connecting, selecting database
$link = mysql_connect('localhost', 'name', 'pass')
or die('Could not connect: ' . mysql_error());
echo 'Connected successfully';
mysql_select_db('web') or die('Could not select database');
// Performing SQL query
$query = 'SELECT cl_date from closing';
if ($query == "cl_date")
{$result = mysql_query("SELECT cl_body FROM closing"); }
else {
echo 'No Closings or Delays.';
}
// Printing results in HTML
echo "<center><table>\n";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td>$col_value</td>\n";
}
echo "\t</tr>\n";
}
echo "</table></center>\n";
// Free resultset
mysql_free_result($result);
// Closing connection
mysql_close($link);
?>
I open the page to see if it gives me ANYTHING, and I get nothing. Where am I being stupid?
Thanks in advance for any help.
N.