anuj_web
New Member
- Messages
- 145
- Reaction score
- 0
- Points
- 0
Hi,
I am trying to generate an HTML table from a MySQL table using PHP
$age is just to calculate age from every record entry
the code gives no output...i.e. no record is fetched from tables
thanks for ne help
I am trying to generate an HTML table from a MySQL table using PHP
Code:
$arr = mysql_fetch_rowsarr($result);
$num_results = mysql_num_rows($result);
for ($i=0; $i < $num_results; $i++)
{
$d=explode("-",$arr[$i+1]["dob"]);
$dd=$d[2];
$mm=$d[1];
$yy=$d[0];
$d=$mm.'/'.$dd.'/'.$yy;
$age=round(dateDiff("/", date("m/d/Y", time()), $d)/365, 0) ;
echo '<tr> <td align="center">'.$arr[$i]['name'].'</td>
<td align="center">'.$age.'</td>
<td align="center"><div STYLE="word-wrap: break-word">'.$row['add'].'</div></td>
<td align="center">'.$arr[$i]['dis'].'</td>
<td align="center">'.$arr[$i]['divi'].'</td>
<td align="center">'.$arr[$i]['phone'].'</td>
<td align="center">'.$arr[$i]['email'].'</td> </tr>';
}
$age is just to calculate age from every record entry
the code gives no output...i.e. no record is fetched from tables
thanks for ne help