2014-02-10 41 views
0

为什么我得到这个错误? 类mysqli_result的对象无法转换为第19行上的字符串 错误是什么?class mysqli_result的对象无法转换为字符串

<?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 offername, description, payout, offerid FROM offers"; 
$exec= $mysqli->query($offername); 
if (mysqli_num_rows($exec) == 0){ 
echo "No Offers Yet"; 
}else{ 
$array= array("$exec"); 
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"; 
}} 
?> 
+2

''$ var“'是一些严重的货运邪教节目的标志...... –

回答

1

此行这里:

$array= array("$exec"); 

引起的字符串转换。错误说你不能这样做。当你把一个字符串放在双引号(包括空字符串)中时,你告诉解析器检查该字符串中的变量并替换它们。为了能够做到这一点,PHP必须能够将它们转换为字符串类型。 stdClass变量没有这个选项。

相关问题