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 7611179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:36:10+00:00 2026-05-31T01:36:10+00:00

Ok i execute this $table = get_personel_table(1); function get_personel_table($id) { global $connection; $query =

  • 0

Ok i execute this

$table = get_personel_table(1);
function get_personel_table($id)
    {
        global $connection;
        $query  = "SELECT * ";
        $query .= "FROM employees ";
        $query .= "WHERE id=" . $id . " ";
        $query .= "ORDER BY id ASC";
        $query_result = mysql_query( $query , $connection );
        confirm_query($query_result);
        $query_result_array = mysql_fetch_array($query_result);
        return $query_result_array; // returns associative array!;
    }

and i do foreach

foreach($table as $table_var)
{
    echo "<td>" . $table_var . "</td>";
} 

and by doing so i get double output … “1 1 1 1 jordan jordan 9108121544 9108121544 testEmail testEmail testAddress testAddress testCounty testCounty”

this below is the result of print_r

 Array
    (
        [0] => 1
        [id] => 1
        [1] => 1
        [department_id] => 1
        [2] => jordan
        [name] => jordan
        [3] => 9108121544
        [EGN] => 9108121544
        [4] => testEmail
        [email] => testEmail
        [5] => testAddress
        [address] => testAddress
        [6] => testCounty
        [country] => testCounty
    )

The information i have in the database is id =>1 , department_id => 1 , and so on …
My question is why i get double feedback(i don’t know how to call it) , 0 = id , 1 = department_id , 2 = name and so on ..

and when i do foreach( … ) i get everything doubled.

  • 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-31T01:36:11+00:00Added an answer on May 31, 2026 at 1:36 am

    From the manual:

    mysql_fetch_array — Fetch a result row as an associative array, a numeric array, or both

    By default, mysql_fetch_array gives both associative and numeric indexes. You don’t want this. You can limit it with the second parameter:

    $query_result_array = mysql_fetch_array($query_result, MYSQL_NUM); // numeric keys only
    $query_result_array = mysql_fetch_array($query_result, MYSQL_ASSOC); // associative keys only
    

    You can also use mysql_fetch_row to only get numeric keys, or mysql_fetch_assoc to only get associative keys.

    $query_result_array = mysql_fetch_row($query_result); // numeric keys only
    $query_result_array = mysql_fetch_assoc($query_result); // associative keys only
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I execute this query: Dim Var Var = ("select max(Autonumber) from tblAutonumber") DoCmd.RunSQL
So I'm trying to execute this query: SELECT r.refID AS rID, avgrat FROM rcc
I'm trying to execute this query: SELECT mac, creation_date FROM logs WHERE logs_type_id=11 AND
I am trying to execute this SQL command: SELECT page.page_namespace, pagelinks.pl_namespace, COUNT(*) FROM page,
Anybody knows how to execute this using the famous Cakephp ORM-based 'find' query function?
I have this elementary query: SELECT d.description, o.code FROM order_positions AS o LEFT JOIN
Basically I am trying to execute this query UPDATE communication_relevance SET score = (SELECT
With this code: var db = google.gears.factory.create('beta.database'); db.open('cominar'); db.execute('CREATE TABLE IF NOT EXISTS Ajax
I am trying to execute this SQL query prior to restoring a .BAK file
I am trying to execute this but cant see any result: <script> function init()

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.