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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:17:34+00:00 2026-05-17T23:17:34+00:00

Thank you in advance for your time/help. I’m a newbie learning php, so please

  • 0

Thank you in advance for your time/help. I’m a newbie learning php, so please keep that in mind.

1st Question
I need a php script that reads a csv file.

2nd Question
How do I echo a specific cell (row and row/column) in that file

I found this script on a similar reply, the script reads the whole file perfectly, but I only want to select a specific cell/value on that csv file. So how do I echo a specific row or a row and column.

$row = 1;
if (($handle = fopen("1.csv", "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
        $num = count($data);
        echo "<p> $num fields in line $row: <br /></p>\n";
        $row++;
        for ($c=0; $c < $num; $c++) {
            echo $data[$c] . "<br />\n";
        }
    }
    fclose($handle);
}
  • 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-17T23:17:35+00:00Added an answer on May 17, 2026 at 11:17 pm

    If you need to select several cases, the best way is to make a multi-dimensional array in php. Otherwise, just throw a few counters into your while loops and done.

    $row = 1;
    $mycsvfile = array(); //define the main array.
    if (($handle = fopen("1.csv", "r")) !== FALSE) {
        while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
            $num = count($data);
            echo "<p> $num fields in line $row: <br /></p>\n";
            $row++;
            for ($c=0; $c < $num; $c++) {
                echo $data[$c] . "<br />\n";
            }
            $mycsvfile[] = $data; //add the row to the main array.
        }
        fclose($handle);
    }
    
    echo $mycsvfile[3][1]; //prints the 4th row, second column.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Thank you in advance for your help. I am developing a java based tool
First off thank you in advance for taking time to help me with this,
Thanks in advance for your help experts. I want to be able to copy
First off, thanks in advance for your help. This issue is driving me nuts.
Greetings and thank you in advance for the help. I created a user control
Thanks in advance for taking the time to read my question. I'm using MySQL
First, a thank you in advance. Second, this is my first post so apologies
what is webparts in asp.net? a simple example on webparts. thank you in advance.
Thank you very much in advance for reading. I'm programming a web application in
Thanks in Advance for reading and answer this question. I got button in asp

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.