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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:07:13+00:00 2026-06-14T03:07:13+00:00

I made this code where I define an array, fliepath, in which I store

  • 0

I made this code where I define an array, fliepath, in which I store the locations of some files.

     include 'last_file.php'; // Include the function last_file
     $last_file = last_file();  // assign to the function a variable and call the  function last_file
    // Connect to the database
     include('connect_thesis.php');

    // Defining an array, which has the three paths to the three different gps receivers
    $file_path[0] = "/Applications/MAMP/htdocs/php_test/check/".$last_file[0];
    //echo $file_path[0]; echo "<br>";
    $file_path[1] = "/Applications/MAMP/htdocs/php_test/check2/".$last_file[1];
    //echo $file_path[1]; echo "<br>";
    $file_path[2] = "/Applications/MAMP/htdocs/php_test/check3/".$last_file[2];
    //echo $file_path[2]; echo "<br>";

Then I made a function called insert() which I want to take as input the $file_path[0]:

     function insert($file_path){

     $fh = fopen($file_path,'r') or die ("Could not open:".mysql_error()).......;

I call the function from the main script as:

         insert($file_path[0]);

I am new in programming and I am sure somewhere I am missing something basic!
The problem is that the function doesn’t run!!!
Can you help me?
Thanx
D.

I THINK I DONT PASS CORRECTLY THE VALUE TO THE FUNCTION. CAUSE I GET NOTHING AS AN ERROR!

  • 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-14T03:07:15+00:00Added an answer on June 14, 2026 at 3:07 am

    A few points to note:

    You are calling insert using only the index 0, consider using a foreach and call the function on each items in your array.

    insert() -> we are missing part of the implementation, but if the file exists, you should not get an error. Keep in mind that you need to close files that you open.

    or die -> it looks like you copy pasted code from elsewhere… mysql_error() will not help you much as you’re dealing with files at the moment. Consider changing it to

    $fh = fopen($file_path,'r') or die ("Could not open:".$file_path)
    

    You should probably handle graciously the error instead of using “die”

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

Sidebar

Related Questions

I have a line, which is a sprite made by using this code CGPoint
I made this little function from code snippets around the net. It does what
I'm stunned, why does this code give me a segmentation fault? #include <stdio.h> #define
I have made this code: var foo=document.createElement(div); var childs=foo.getElementsByTagName(*); console.log(childs.length);//0 OK var a=document.createElement(a); foo.appendChild(a);
I have made this code to open a database(created in SQLite browser) stored in
How can I improve this code? What has made this long winded is the
I am pretty new at C# and .NET, but I've made this code to
I have a problem, and I made this test code to show you my
I've made this piece of code, it will re-size images on the fly, if
Ok. I've made this awe-crap-code Exporting table to XLS (but still no idea how

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.