Shadow Hatake Posted March 20, 2006 Share Posted March 20, 2006 [code] <?phpinclude('dbconnect.php');$id = $_GET['jid'];$question = $_GET['q'];if( isset( $_GET['jid'] ) ) { if( isset( $_GET['q'] ) ) { $query = 'SELECT '.$question.' FROM boards WHERE id = "'.$id.'"'; $result = mysql_query( $query ); if( $result ) { echo $result; } else { echo 'Error'; } } else { echo 'Page accessed incorrectly...'; }} else { echo 'Page accessed incorrectly...';}?>[/code]All I'm getting is resource id #3 when it should be showing the query. Help? Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted March 20, 2006 Share Posted March 20, 2006 Change:[code]echo $result;[/code]to:[code]echo "<table>";while ($row = mysql_fetch_array($result)) { echo "<tr>"; foreach ($row as $key => $value) { echo "<td>$key</td><td>$value</td>"; } echo "<tr>";}echo "</table>";[/code]when you assign $result to mysql_query("some sql") it creates a reference to the object that contains your data. You have to use other php mysql functions to access the data contained inside. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.