Okay, I think I've done it using this ;
while ($row = mssql_fetch_array($result)) {
$customer_address_1 = $row["customer_address_1"] ;
$customer_address_2 = $row["customer_address_2"] ;
$customer_address_3 = $row["customer_address_3"] ;
$customer_town = $row["customer_town"] ;
$customer_county = $row["customer_county"] ;
$customer_postcode = $row["customer_postcode"] ;
$line_number = 1 ;
unset($address_tidy) ;
$address_tidy = array() ;
if (trim($customer_address_1) != "") {
$address_tidy[$line_number] = $customer_address_1 ;
$line_number++ ;
}
if (trim($customer_address_2) != "") {
$address_tidy[$line_number] = $customer_address_2 ;
$line_number++ ;
}
if (trim($customer_address_3) != "") {
$address_tidy[$line_number] = $customer_address_3 ;
$line_number++ ;
}
if (trim($customer_town) != "") {
$address_tidy[$line_number] = $customer_town ;
$line_number++ ;
}
if (trim($customer_county) != "") {
$address_tidy[$line_number] = $customer_county ;
$line_number++ ;
}
if (trim($customer_postcode) != "") {
$address_tidy[$line_number] = $customer_postcode ;
$line_number++ ;
}
echo "<td nowrap>ADDTIDY1 = $address_tidy[1]<br>
ADDTIDY2 = $address_tidy[2]<Br>
ADDTIDY3 = $address_tidy[3]<br>
ADDTIDY4 = $address_tidy[4]<br>
ADDTIDY5 = $address_tidy[5]<br>
ADDTIDY6 = $address_tidy[6]<br></td>
}
This works great, but for blank address_tidy[] lines I get ;
Notice: Undefined index: 2 in C:\Inetpub\cits\sql.php on line 118
Notice: Undefined index: 3 in C:\Inetpub\cits\sql.php on line 119
Notice: Undefined index: 4 in C:\Inetpub\cits\sql.php on line 120
Is there any easy way to fix this or shall I just change the error reporting?