I have PHP Code that is supposed to display the image name that is saved into my MSSQL table's row column photo. Some rows have the photo column set to NULL while some have the data 02.jpg in the photo column. If i use the code below, 02.jpg does not show up because it starts with zero. I am looking to find a way to check if the column is set to NULL rather than empty, because empty is not allowing some image names.
Here is the PHP code:
$picature2 = "SELECT photo1 FROM used_trailers1 WHERE orderid = $sn";
$query1=mssql_query($picature2, $conn);
$array1=mssql_fetch_assoc($query1);
$picature2=stripslashes($array1['photo1']);
if (empty($picature2['photo1'])){
$picature2= "No Image";
} else {
$picature2=stripslashes($array1['photo1']);
}
The code above correctly displays the "No Image" if the photo column is set to NULL, but if the photo column is 02lady.jpg then it will not work because it starts with a zero.
Here is what I tried:
if (IS_NULL($picature2['photo1'])){
So far that does not work and does not display the "No Image" if the column data for photo is NULL.
Thanks for any help. All help is greatly appreciated.
$picature2['photo1']===null0so what?'02.jpg'won't be treated as empty.$picature2then using$array1. Does your code work even somehow?