Hi
I'm a newbie, I keep dipping in and out of PHP/MYSQL and am using Dreamweaver to generate code.
I am trying to set up a diary of events.
I can select all the distinct months and pass to a query page, like so:
<?php
mysql_select_db($database_cwt, $cwt);
$query_Recordset5 = "SELECT distinct monthname(Date), DATE_FORMAT(Date, '%M') as month FROM events ORDER BY events.`Date`";
$Recordset5 = mysql_query($query_Recordset5, $cwt) or die(mysql_error());
$row_Recordset5 = mysql_fetch_assoc($Recordset5);
$totalRows_Recordset5 = mysql_num_rows($Recordset5);
?>
This works fine and generates the correct url, http://localhost/xampp/testingserver/event...hp?date=January
But I can't seem to retrieve it through the query page, I've tried alsorts, most of which is generated by Dreamweaver.
<?php
$colname_Recordset1 = "1";
if (isset($HTTP_GET_VARS['date'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['date'] : addslashes($HTTP_GET_VARS['date']);
}
mysql_select_db($database_cwt, $cwt);
$query_Recordset1 = sprintf("SELECT * FROM events WHERE (DATE_FORMAT('date', '%M') = '%s'", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $cwt) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
I seem to be getting worse instead of better.
Is my syntax just muddled or have I got it completely wrong?
Any suggestions welcome