Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7054455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:37:43+00:00 2026-05-28T03:37:43+00:00

I try to retrieve a array from one table What is wrong with this

  • 0

I try to retrieve a array from one table What is wrong with this code?

$_fbexclude = mysql_query("SELECT fbempfang FROM fbinvite WHERE fbreturn = '1' ");
$fbexcludearray= mysql_fetch_array($_fbexclude);

// Convert the array 
$excludes = implode(',', $fbexcludearray);

From echo $excludes; It only gives me just the following response: 1000033xxx161,1000033xxx161 Twice the same fbempfang

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:37:43+00:00Added an answer on May 28, 2026 at 3:37 am

    See if the following gives you what you want (FIXED):

    $_fbexclude = mysql_query("SELECT fbempfang FROM fbinvite WHERE fbreturn = '1'");
    $fbexcludearray = array();
    while ($row = mysql_fetch_assoc($_fbexclude)) {
      $fbexcludearray[] = $row['fbempfang'];
    }
    
    // Convert the array 
    $excludes = implode(',', $fbexcludearray);
    

    mysql_fetch_array() and it’s siblings (_assoc, _row) only retrieve one row at a time. This means that your original code will only give you the first returned row – to work around this, we use the loop you see above.

    The reason you see the same data twice is because mysql_fetch_array() returns a mixed indexed and associative array, which contains all the data twice over. For this reason, it is much better to use mysql_fetch_assoc() or mysql_fetch_row(), as you rarely need both formats.

    In fact, it is much better to use mysqli, but the same information applies to that as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get an error when I try to retrieve from SQLite into an Array.
I try to retrieve the latest added bookingID from table booking but I do
Bit confused with this one. Basically, I have a column in a table, and
I am using UTF-8 encoding to try and send a byte array from my
$pid = $fb->api(array( 'method' => 'fql.query', 'query' => 'SELECT first_name from user where uid='.$session['uid'])
I try to retrieve all database records from Tournament which belongs to User. $cond
I retrieve data from a mysql database. I want to make this data available
I am using the following code to retrieve an amount of Tweets from the
I get a Data type mismatch criteria expression error when i try to retrieve
Try loading this normal .jpg file in Internet Explorer 6.0. I get an error

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.