I have a fairly simple question I'm guessing. I have the following code at the beginning of my function, but it must not be correct because it causes the blank to turn blank. If I comment out the IF statement, everything runs fine.
What am I doing wrong?
Sorry, it's probably very basic...
function get_entries($order = 'newest', $slug = null) {
$wheresql = '';
if (isset($slug)) {
$wheresql = 'WHERE entries.category_id = (SELECT categories.category_id FROM categories WHERE categories.category_slug = "'. $slug .'")'
}
Basically, I just want to do something if the user supplied a $slug variable, otherwise skip it.
Thanks.