Please describe me what is the main use and difference between question mark and colon (? and :) in php ?
Code:
function get_all_state_details($state_id)
{
$sql = "SELECT * from states ";
$rows = $this->db->query($sql);
while ($record = $this->db->fetch_array($rows))
{
$strSelected = $record['state_id'] == $state_id ? 'selected = "selected"' : '';
$strState .= '<option value = "'.$record['state_id'].'" '.$strSelected.' >'.$record['state_name'].'</option>';
$i++;
}
return $strState;
}
Comment