Jump to content

echo data of an SQL query.. nothing echo'ing?


buzzkip

Recommended Posts

Hi All,

 

I'm trying to echo the response from an SLA query, the query works and returns the data when I test it on an SQL application.. but when I run it on my webpage it won't echo the result.

 

Please help?

 

 

<?php   $mysqli = mysqli_connect("removed", "removed", "removed", "removed");  $sql = "SELECT posts.message FROM posts INNER JOIN threads ON posts.pid=threads.firstpost WHERE threads.firstpost='1'";  $result = mysqli_query($mysqli, $sql);   echo {$result['message']}; ?>

 

When I use:

 

<?php   
$mysqli = mysqli_connect("removed", "removed", "removed", "removed");  
$query = "SELECT posts.message FROM posts INNER JOIN threads ON posts.pid=threads.firstpost WHERE threads.firstpost='1' ";  
$result = mysqli_query($mysqli,$query);
while ($row = mysqli_fetch_assoc($result)) {
   echo $row['message'] . "<br/>";
}
?>

 

I get error:

 

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /removedURL/forumdisplay.php(1123) : eval()'d code on line 39

 

 

When I take away the set of line 39 and use this:

 

<?php   
$mysqli = mysqli_connect("removed", "removed", "removed", "removed");  
$query = "SELECT posts.message FROM posts INNER JOIN threads ON posts.pid=threads.firstpost WHERE threads.firstpost='1' ";  
$result = mysqli_query($mysqli,$query);
?>

 

 

 

I get this error:

 

Error Type:

Catchable Fatal Error (4096)

Error Message:

Object of class mysqli_result could not be converted to string

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.