Why doesn't this work:
$sort_type='MONTHNAME(PostDate)';
$sort_select='June';
$show_query = "SELECT * FROM my_table WHERE $sort_type = '$sort_select'";
$result = mysql_db_query ("my_db", $show_query)
or die ("Cannot execute Date or Country lookup. Please try again later.");
When this does:
$show_query = "SELECT * FROM my_table WHERE MONTHNAME(PostDate) = 'August' ";
$result = mysql_db_query ("my_db", $show_query)
or die ("Cannot execute Date or Country lookup. Please try again later.");
$num_results = mysql_num_rows($result);
With error checking, the first way results in a Wrong Parameter Count error. I'm trying to eventually build a function whereby I can pass the $sort_type and $sort_select vars to the query. They look exactly the same to me. What am I missig?
Dave