This question already has an answer here:
I'm currently trying to resolve a bug in another programmers code (who I can't contact). His code is as follows;
$prooms = mysqli_query($con, "select * from property_room where property_id='".(int)$property_id ."'") or die(mysqli_error($con));
while($r = mysqli_fetch_array( $prooms )) {
$rooms[]=array(
"room_name" => $r['property_room_name'],
"room_description" => $r['property_room_description'] ,
"room_length" => $r['property_room_length']?$r['property_room_dimension_unit']:NULL ,
"room_width" => $r['property_room_width']?$r['property_room_dimension_unit']:NULL ,
"room_dimension_unit" => $r['property_room_dimension_unit']?$r['property_room_dimension_unit']:NULL ,
"room_photo_urls" =>$r['property_room_images_url']
);
}
For the line;
"room_length" => $r['property_room_length']?$r['property_room_dimension_unit']:NULL ,
Does this mean if $r['property_room_length'] is empty the string is set to NULL?
What I'm trying to achieve is that if $r['property_room_length'] is set to '0.00' I want the string to be set to NULL.
Aucun commentaire:
Enregistrer un commentaire