cluce Posted June 14, 2007 Share Posted June 14, 2007 I am trying to post a detail message and say who the message was posted by. (the owner of the message) but it doesnt work quite right it says posted by the word "ARRAY". Some reason its not getting the name from the database. Can someone tell me why this is? here is my code.. //get owner of post $get_owner_sql = "SELECT post_owner FROM forum_posts WHERE topic_id = '".$_GET["topic_id"]."'"; $get_owner = mysqli_query($mysqli,$get_owner_sql); $post_owner = mysqli_fetch_array($get_owner); //create the display string $display_block = " <p>Showing posts for the <strong>".$topic_title."</strong> topic by ".$post_owner.":</p> <table width=\"100%\" cellpadding=\"1\" cellspacing=\"1\" border=\"1\" bordercolor=\"#000000\"> <tr> <th>POST</th> </tr>"; Quote Link to comment https://forums.phpfreaks.com/topic/55578-solved-fetch-array-not-working-like-i-thought-it-would/ Share on other sites More sharing options...
Psycho Posted June 14, 2007 Share Posted June 14, 2007 That's because mysqli_fetch_array() fetches, well, an array! In your case it is an array with one value. But, you still need to reference the value as an array with: $post_owner['post_owner'] Quote Link to comment https://forums.phpfreaks.com/topic/55578-solved-fetch-array-not-working-like-i-thought-it-would/#findComment-274593 Share on other sites More sharing options...
cluce Posted June 14, 2007 Author Share Posted June 14, 2007 thanks Quote Link to comment https://forums.phpfreaks.com/topic/55578-solved-fetch-array-not-working-like-i-thought-it-would/#findComment-274598 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.