I'm using full calendar from Arshaw, this is how I'm adding events to the calendar
echo json_encode(array(
array(
'id' => 111,
'title' => "Place Date",
'start' => "$place_date[0]",
'color' => "purple"
),
array(
'id' => 222,
'title' => "Due Date",
'start' => "$due_date[0]",
'color' => "red"
),
array(
'id' => 333,
'title' => "Confirmed",
'start' => "$confirmdate[0]",
'end' => "$promisedate[0]",
'color' => "blue"
)
));
}
I don't always have information about "confirmdate" so I need to perform an if statement to check if my mysql returns an empty value or not, I like to achieve something like this:
if (mysqli_num_rows($confirmdate[0] > 0) {
echo array(
'id' => 333,
'title' => "Confirmed",
'start' => "$confirmdate[0]",
'end' => "$promisedate[0]",
'color' => "blue"
)
}
Is there a way to perform an if like this inside a json_encode?
mysqli_num_rowslike that. I took it out in my answer.