这是我的编码,我是 php 新手,我经常在那里使用 codigneter,我用它在模型中编写查询,但我不知道在哪里编写查询。此代码生成的错误
注意:未定义的偏移量:C:\wamp\ 中的 0
并且无法从数据库中获取数据
<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>