-1

Object of class mysqli_result could not be converted to string on line 27 Could Someone explain how to fix this, error description, im trying to make a virtual PHP Shop For a friend And what im trying to do is to show a list of offers and their description, what im trying to do is to fetch data from a database to list the offers, the code keeps saying this error, does anyone know how to fix it?

  <?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";
}}
?>
Dharman
  • 30,962
  • 25
  • 85
  • 135
user3245415
  • 65
  • 1
  • 1
  • 4

1 Answers1

0

x, y, z, a and the 0, 1, 2, 3 has to be changed to attain the required result, but that's the idea. The error is on this line: $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";
}}

?>

CodeBird
  • 3,883
  • 2
  • 20
  • 35