all the if statement is doing is checking to make sure that there is some value inside the variable $result. If there is then display the results. The 'fieldName1' is the fieldName or data column name in the database you want to display and is stored in the array $data[]. So the answer is yes. It references the actual table column name.
I don't know exactly how you have your database set up, but basically what you would want to do is continue adding as many $data['fieldName'] to your one echo statement for each column in the database. How many columns do you have in your database? If you have 50 columns in your db, you would add 50 $data['fieldName'] to your echo statement, each one referencing the appropriate colum name. If that $data['fieldName'] contains a value, it will print to the screen, if not, you will just get a blank space.
However in my example, it will print two characters regardless if there is any data in the $data['fieldName'] or not, meaning if you have five consecutive $data['fieldName'] empty in the array, you will get 10 to print to the screen which you probably don't want. In this case you could do an if statement for each returned result something like this.
$sql = "SELECT * FROM tableName";
$result = mysql_query($sql);
if($result){
while($data = mysql_fetch_array($result)){
if($data['fieldName1'] != ""){
echo "".$data['fieldName1']."  ";
}
if($data['fieldName2'] != ""){
echo "".$data['fieldName2']."  ";
}
if($data['fieldName3'] != ""){
echo "".$data['fieldName3']."  ";
}
if($data['fieldName4'] != ""){
echo "".$data['fieldName4']."  ";
}
// and so on for every column in your db
}
}
Hope this helps
By the way I noticed you are from Lebanon OH, I'm from Columbus, OH. Just thought I'd mention that.