Hi,
Im retrieving data from a DB with WHILE structure:
while(odbc_fetch_row($result)){
$user_id = odbc_result($result, 1);
$name = odbc_result($result, 4);
$uma = odbc_result($result, 2);
$ma = odbc_result($result, 3);
$tel = odbc_result($result, 5);
$fax = odbc_result($result, 6);
$cell = odbc_result($result, 7);
$loc = odbc_result($result, 8);
$mail = odbc_result($result, 9);
$dept = odbc_result($result, 10);
printf("<tr>
<td>$name</td>
<td>$user_id</td>
<td>$uma</td>
<td>$ma</td>
<td>$tel</td>
<td>$fax</td>
<td>$cell</td>
<td>$loc</td>
<td><a href=\"mailto:$mail\">$mail</a></td>
<td>$dept</td>
</tr>\n"
}
My question:
If no value is found for a certain field, I want to specify a default value.
example:
If no telephone number was found for some employees, a default value (ex:1234 instead of nothing ) must be displayed.
Please can you help me with this?
thanx
chris
Im retrieving data from a DB with WHILE structure:
while(odbc_fetch_row($result)){
$user_id = odbc_result($result, 1);
$name = odbc_result($result, 4);
$uma = odbc_result($result, 2);
$ma = odbc_result($result, 3);
$tel = odbc_result($result, 5);
$fax = odbc_result($result, 6);
$cell = odbc_result($result, 7);
$loc = odbc_result($result, 8);
$mail = odbc_result($result, 9);
$dept = odbc_result($result, 10);
printf("<tr>
<td>$name</td>
<td>$user_id</td>
<td>$uma</td>
<td>$ma</td>
<td>$tel</td>
<td>$fax</td>
<td>$cell</td>
<td>$loc</td>
<td><a href=\"mailto:$mail\">$mail</a></td>
<td>$dept</td>
</tr>\n"
}
My question:
If no value is found for a certain field, I want to specify a default value.
example:
If no telephone number was found for some employees, a default value (ex:1234 instead of nothing ) must be displayed.
Please can you help me with this?
thanx
chris