Here is my coding I am new to php i often use codigneter there I use to write queries in models but i have no idea where to write the query. This code generates the error of
Notice: Undefined offset: 0 in C:\wamp\
and is unable to fetch data from DB
<div class="table">
<table cellspacing="0" cellpadding="0">
<thead>
<tr>
<th width="50" class="first">Id</th>
<th width="117">Name</th>
<th width="145">E.mail</th>
<th width="63">Phone</th>
<th width="145">Address</th>
<th width="145">Payer Email</th>
<th width="45">Amount</th>
<th width="45" class="last">Status</th>
</tr>
</thead>
<tbody class="table_body">
<?php
$result = mysql_query("SELECT * FROM myorders ");
$fields = mysql_fetch_assoc( $result );
if(isset($fields)){
if(count($fields)>0){
for($j=0; $j<count($fields); $j++){ ?>
<tr>
<td class="first style2"><?php echo $fields[$j]->id?></td>
<td><?php echo $fields[$j]->name?></td>
<td><?php echo $fields[$j]->email?></td>
<td><?php echo $fields[$j]->phone?></td>
<td><?php echo $fields[$j]->address?></td>
<td><?php echo $fields[$j]->payer_email?></td>
<td><?php echo $fields[$j]->amount?></td>
<td><?php echo $fields[$j]->status?></td>
</tr>
<?php }
}
}
?>
</tbody></table>
</div>