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']}; ?>

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.