Php 为什么在以下场景中无法访问资源ID。? 强度海洋空气BB 通信/响应时间 汇率竞争力 执行方面的专门知识 提名 金融交易 国家网络 网络协会。 代理协议 平均分 原产地费用 目的地费用
我在mysql获取协会($agent\u res)中使用了两次Php 为什么在以下场景中无法访问资源ID。? 强度海洋空气BB 通信/响应时间 汇率竞争力 执行方面的专门知识 提名 金融交易 国家网络 网络协会。 代理协议 平均分 原产地费用 目的地费用,php,mysql,sql,Php,Mysql,Sql,我在mysql获取协会($agent\u res)中使用了两次$agent\u res。 它在第一个while循环中正常工作,我从数据库中获取值。 但是当我在while循环中第二次使用它时,它并没有进入while循环。 在第二次while循环之前,我打印了$agent\u res的值,我得到了资源ID。 它是这样打印的:resourceid#6 请任何人帮我解决这个问题。 提前谢谢。 等待您的答复。您需要将指针设置回开头,如下所述: <?php $agent_details
$agent\u res
。
它在第一个while循环中正常工作,我从数据库中获取值。
但是当我在while循环中第二次使用它时,它并没有进入while循环。
在第二次while循环之前,我打印了$agent\u res
的值,我得到了资源ID。
它是这样打印的:resourceid#6
请任何人帮我解决这个问题。
提前谢谢。
等待您的答复。您需要将指针设置回开头,如下所述:
<?php
$agent_details = "SELECT * FROM `database`.`table` WHERE country = 'India'";
$agent_res = $n -> querySend($agent_details);
?>
<table border="1" cellspacing="1" cellpadding="1" id="outerTable">
<thead valign="top">
<tr>
<td>S.No.</td>
<td>Agent </br>name</br> </td>
<td>Port / Offices</td>
<td>Address</td>
<td>Tel</td>
<td>Fax</td>
<td>Contact</td>
<td>Email Address</td>
<td>Website Address</td>
</tr>
<?php
while($row1 = mysql_fetch_assoc($agent_res))
{
?>
<tr>
<td><?php echo $row1['agent_no'] ?></td>
<td><?php echo $row1['agent_name'] ?></td>
<td><?php echo $row1['port'] ?></td>
<td><?php echo $row1['address'] ?></td>
<td><?php echo $row1['tel'] ?></td>
<td><?php echo $row1['fax'] ?></td>
<td><?php echo $row1['contact'] ?></td>
<td><?php echo $row1['email_id'] ?></td>
<td><?php echo $row1['website_address'] ?></td>
</tr>
<?php
}
?>
</thead>
<tbody valign="top">
<tr>
<td class="cell">Strength Ocean Air BB</td>
<td class="cell">Communication / Response Time</td>
<td class="cell">Rate Competitiveness</td>
<td class="cell">Expertise in Execution</td>
<td class="cell">Nominations</td>
<td class="cell">Financial Dealing</td>
<td class="cell">Country Network</td>
<td class="cell">Network Assoc.</td>
<td class="cell">Agency Agreement</td>
<td class="cell">Average Score</td>
<td class="cell">Origin Charges</td>
<td class="cell">Destn Charges</td>
</tr>
<?php
while($row2 = mysql_fetch_assoc($agent_res))
{
?>
<tr>
<td class="cell"><?php echo $row2['strength_ocean_air_bb'] ?></td>
<td class="cell"><?php echo $row2['communication_or_responce_time'] ?></td>
<td class="cell"><?php echo $row2['rate_competitiveness'] ?></td>
<td class="cell"><?php echo $row2['expertise_in_execution'] ?></td>
<td class="cell"><?php echo $row2['nominations'] ?></td>
<td class="cell"><?php echo $row2['financial_dealing'] ?></td>
<td class="cell"><?php echo $row2['country_network'] ?></td>
<td class="cell"><?php echo $row2['network_assoc'] ?></td>
<td class="cell"><?php echo $row2['agency_agreement'] ?></td>
<td class="cell"><?php echo $row2['avg_score'] ?></td>
<td class="cell"><?php echo $row2['origin_charges'] ?></td>
<td class="cell"><?php echo $row2['destination_charges'] ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
mysql_data_seek($agent_res, 0);
while($row2 = mysql_fetch_assoc($agent_res))
....
...