I have this code:
$query = "SELECT headline, url, ID, external, date_format(date, '%b %d')as news_date FROM news WHERE MONTH(date) = '$month' ORDER BY ID DESC";
How do I change it to work with a WHERE clause like this:
WHERE ID='" . $_GET['ID'] . "'
Sort of confused by what you are asking... but usually an ID field is an int. and does not need single tics around it
try
WHERE ID= ".$_GET["ID"];
Not sure if that helps at all.
Originally posted by tripwater Sort of confused by what you are asking... but usually an ID field is an int. and does not need single tics around it try WHERE ID= ".$_GET["ID"]; Not sure if that helps at all.
Sorry for the confusion, I need to do something like:
WHERE MONTH(date)='" . $_GET['$month'] . "'
But that doesn't work...
Have you echoed $_GET['$month']?
is it holding a month string? I just tried this query on one of my tables and it seemed to work fine.
I am not seeing anything wrong with your query.
Originally posted by jbachris Sorry for the confusion, I need to do something like: WHERE MONTH(date)='" . $_GET['$month'] . "' But that doesn't work... [/B]
Originally posted by jbachris Sorry for the confusion, I need to do something like:
But that doesn't work... [/B]
this is looking for a variable in the url called $month
like index.php?$month=12
try $_GET['month']
Good eye, I completely missed that!