MySQL Forums
Forum List  »  PHP

if statement in mysqli_fetch_arrary
Posted by: jj krause
Date: February 09, 2015 01:34PM

this array pulls data from a table that has many null entries. i am trying to make it not display the label in front of the data if the table has a null entry for that row.
example : if the row section(line7) was blank i do not want to echo "section".

if (mysqli_num_rows($result)== 0){
echo "No Match Found";
}
else {
while ($row = mysqli_fetch_array($result)){
echo "Name: " .$row['First_Name']. " " .$row['Middle_Name']. "<br>";
echo "Section: " .$row['Section']. " Lot: " .$row['Lot']. "<br>";
}
}

i attempted to solve this in the array with the if statement below but i keep on getting syntax errors.

if(.$row['Middle_Name']. != ""){ echo " Middle_Name " .$row['Middle_name']. } ;

i am not very fluent in php so any help would be appreciated.

php version 5.3.4

Options: ReplyQuote


Subject
Written By
Posted
if statement in mysqli_fetch_arrary
February 09, 2015 01:34PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.