Cachable致命错误:类mysqli_result的对象无法转换为字符串

时间:2014-02-10 22:34:39

标签: php html http

类mysqli_result的对象无法在第27行转换为字符串 有人可以解释如何解决这个问题,错误描述,我试图制作虚拟PHP商店对于朋友而我想要做的是显示商品列表和他们的描述,我试图做的是从一个获取数据数据库列出要约,代码一直说这个错误,有人知道如何修复它吗?

  <?php 
//Offer Wall
// Put your CPA Networks Virtual Currency Widget after the End of this first PHP
//Segment
include "mysqli_config.php";
?>
<table>
<tr>
<th>Offer Name</th>
<th>Description</th>
<th>Payout</th>
</tr>
</table>
<?php
$offername= "SELECT * FROM offers WHERE active = 1";
$exec= $mysqli->query($offername);
$array = array($exec);
if (mysqli_num_rows($exec) == 0){
echo "No Offers Yet";
}else{
while (list($x, $y, $z, $a) = $array){
echo " <tr>\n " .
" <td><a href=\"click.php?=$a\">Click Here to Open Offer</a></td>\n" .
" <td>$z</td>\n" .
" <td>$y</td>\n" .
" <td>$x</td>\n";
}}
?>

1 个答案:

答案 0 :(得分:0)

x,y,z,a和0,1,2,3必须改变才能达到要求的结果,但这就是想法。错误在这一行:$ array = array($ exec);

<?php 
//Offer Wall
// Put your CPA Networks Virtual Currency Widget after the End of this first PHP
//Segment
include "mysqli_config.php";
?>
<table>
<tr>
<th>Offer Name</th>
<th>Description</th>
<th>Payout</th>
</tr>
</table>
<?php
$offername= "SELECT * FROM offers WHERE active = 1";
$exec= $mysqli->query($offername);
//$array = array($exec);
if (mysqli_num_rows($exec) == 0){
    echo "No Offers Yet";
}else{
   while ($array=mysqli_fetch_row($exec)){
     $a=$array[3];
     $x=$array[0];
     $y=$array[1];
     $z=$array[2];
     echo " <tr>\n " .
        " <td><a href=\"click.php?=$a\">Click Here to Open Offer</a></td>\n" .
        " <td>$z</td>\n" .
        " <td>$y</td>\n" .
        " <td>$x</td>\n";
}}

&GT;