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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:41:47+00:00 2026-06-12T19:41:47+00:00

I have a same problem where read data from mysql and store it in

  • 0

I have a same problem where read data from mysql and store it in an array.
I have table something like this

id     engineering     science      language
_____________________________________________

1      chemical        bio           english
2      electrical      chemistry     malay 
3      mechanical      astronomy     spanish 

How to I read for example all the data from engineering and store it in an array? Can I do any hashing in PHP, or associative array already include this hashing function.
Please help.

  • 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-06-12T19:41:50+00:00Added an answer on June 12, 2026 at 7:41 pm

    A barebones example using MySQLi:

    // connect to your database
    $mysqli = new mysqli("hostname", "username", "password", "database");
    if (mysqli_connect_errno()) {
        printf("Connect failed: %s\n", mysqli_connect_error());
        exit();
    }
    
    // setup your query
    $query = "SELECT * FROM engineering ";
    $results = array();
    // execute your query
    if ($result = $mysqli->query($query)) {
        // the query was successful; iterate through each result fetching an
        // associative array and add it to the `$results` list
        while ($row = $result->fetch_assoc()) {
            $results[] = $row;
        }
        $result->free();
    }
    $mysqli->close();
    
    // process all results in `$results` array! (simple output)
    foreach ($results as $result) {
        echo $result['id'] . ' ' . $result['engineering'] . '<br />';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read the other threads regarding this same problem but I still don't
How do I read data from a file if my file is like this
please I have the same problem as I found here MySQL - Selecting data
I have read some posts having the same problem. I tried to adapt their
I have the same problem as described in ( Last record of Join table
I have basically the same problem outlined in this question, however I am using
I can't seem to find an article with this same problem. I have an
I use the ruby-gem sequel to read utf-8-encoded data from a MSSQL-Server table. The
I have the same problem that is listed in the following thread. WSDL first
I have the same problem as in the following post . So I am

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.