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

  • Home
  • SEARCH
  • 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 7420509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:15:06+00:00 2026-05-29T08:15:06+00:00

I have imported a CSV to fill a multidimensional array. $arrCSV . <?php $foundOneMatchingRow

  • 0

I have imported a CSV to fill a multidimensional array. $arrCSV.

<?php     
  $foundOneMatchingRow = FALSE;
  foreach ($arrCSV as $row) {
    if (strpos($row['5'], $val) !== FALSE && strlen($row['5']) > 4) {
      $foundOneMatchingRow = TRUE;
      echo $row['6'];
    }
  }
?>

The above code outputs from the value of $val = $_GET['menu']; which is done buy the URL.

I would like to make a search if possible please based on words in $row['6'];.

There will be a search on the page which will pass the search to the URL.

Which would look something like http://example.com/search.php?val=dogs

So the code would look for ANYTHING that relates to dog in $row [6]

I hope I have been clear. Any gudiance would be more than welcome. I am testing everything now.

Thank you

  • 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-29T08:15:07+00:00Added an answer on May 29, 2026 at 8:15 am

    if (strpos($row['6'], $val) !== FALSE) will evaluate to true if $row['6'] contains “dog” (if $val‘s value is “dog”). That is, will evaluate to true as well if the string in $row['6'] is “bulldog” or “whateverdogwhatever”.

    BTW, why do you need this condition: strlen($row['5']) > 4? (which I guess should be at least strlen($row['6']) > 4 if you search on $row['6']).

    Something else: aren’t you confusing strings and integers? Maybe if (strpos($row['6'], $val) !== FALSE) should be if (strpos($row[6], $val) !== FALSE)?

    EDIT

    I would suggest to define constants for your CSV columns, for readability.

    What about for example:

    define('CSV_ID', 5);
    define('CSV_TEXT', 6);
    
    //...
    foreach ($arrCSV as $row) {
      if (strpos($row[CSV_TEXT], $val) !== FALSE && strlen($row[CSV_ID]) > 4) {
        //...
        echo $row[CSV_TEXT];
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have my CSV file imported as such: records = FasterCSV.read(path, :headers => true,
I have an sqlite3 database that I imported from CSV, but the CSV quoted
I have a table with 600+ columns imported from a CSV file with special
I have a very large CSV file that I imported into a sqlite table.
I have tried the merge function to merge two csv files that I imported.
I've imported a dataset from CSV into Ruby as an array of arrays (each
I have imported a .csv file of 10,000 locations and I need to loop
I have a scenario where data needs to be imported from a CSV file
I have imported a csv file containing spatial area information in varchar, then converted
I have a MySQL table that I have imported from a CSV file. In

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.