Question

php question Write code to import an external file named 'clonetrooperlist.csv'. Retrieve and echo each line.

php question

Write code to import an external file named 'clonetrooperlist.csv'. Retrieve and echo each line.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

"fgetcsv()" method is used to parse a csv file line by line until we encounte EOF(end of file).

<?php
$file_ptr = fopen("clonetrooperlist.csv","r");

while(! feof($file_ptr))
  {
  print_r(fgetcsv($file_ptr));
  }

fclose($file_ptr);
?>

Add a comment
Know the answer?
Add Answer to:
php question Write code to import an external file named 'clonetrooperlist.csv'. Retrieve and echo each line.
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a line of code that will declare a file variable named data. Assuming that the...

    Write a line of code that will declare a file variable named data. Assuming that the variable data was correctly created in the previous problem, write a line of code that will associate the variable with a file named grades.txt that is being opened for reading. Assuming that grades.txt only contains integers, write a line of code that will use the variable data to read in the first integer and store in a variable named test1 that has already been...

  • 1. Write the php statements to connect to MySQL server and select the database named personnel....

    1. Write the php statements to connect to MySQL server and select the database named personnel. The database personnel is located at localhost server. The user id and password to log on to the server are finalexam and thePassword respectively. 2. Using the above connection, write the php statements to retrieve the name and the email fields from all records of the users table ( 'SELECT name, email FROM users') and display them one record per line.

  • PYTHON write a program that will open a file named data.txt and read each line of...

    PYTHON write a program that will open a file named data.txt and read each line of the file one at a time. Each line should be printed to the screen along with a line number

  • Write PHP that does the following: Creates 4 variables, with values “My”, “Name”, “is”, “Bill”. Concatenates...

    Write PHP that does the following: Creates 4 variables, with values “My”, “Name”, “is”, “Bill”. Concatenates all 4 variables using the concatenation operator, while adding a space between each one and assigns the result of the concatenation into a 5th variable named $stringCatResult. Display the $stringCatResult value using an echo statement. Write PHP that does the following: Creates 2 variables, with values 12 and 3 Write five separate lines of code that performs an arithmetic operation on the 2 variables....

  • Create a folder named "TrainerApp". In that folder create the following files. Create a PHP file,...

    Create a folder named "TrainerApp". In that folder create the following files. Create a PHP file, "insert-user-form.php", with a form that has the following fields: - First Name (text) - Last Name (text) - Email (text) - Password (text) - Submit button Create another PHP file, "insert-exercise-form.php" with a form that has the following fields: - Exercise Name (text) - Description (text) - Demonstration Image (file) - Submit button Create another PHP file, "login-user-form.php" with a form that has the...

  • (10 points) Line sums: Write a PHP funcion called lineSum that accepts a parameter and retums the sum of the integers o...

    (10 points) Line sums: Write a PHP funcion called lineSum that accepts a parameter and retums the sum of the integers on that line number. For example, you may have file named sums.txt that ontain s the following data integer and a filen ame one as 5 15 10 20 25 50 200 50 60 75 100 A call to lineSum( "sums.txt", 2) retums 25, and a call to lin eSum"sum s.txt", 5) retums 200. Please al so submit the...

  • php QUESTION 4 We have an associative array storing passwords of each user write PHP code...

    php QUESTION 4 We have an associative array storing passwords of each user write PHP code to check if the password from user by POST method is wrong or right. Spassword array(user1' -12345, user?> password. user3ts helloworld. user4 For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac password1234): Words:0 Path: p QUESTION S When defining an identifier in PHP you remember that ? SResult OA identifier are case senstive. So Sresult is different trom O B. Identifiers can be any...

  • Suppose there is a module named ‘numpy’. Write a line of code that adds all of...

    Suppose there is a module named ‘numpy’. Write a line of code that adds all of the module’s functions into your own code. Write a line of code that assigns the variable x to a list with four numbers of your choice. Under it, write a line of code that then sets the second element of x to 40.

  • USING PYTHON PROGRAMMING LANGUAGE 15. Write code to open a file named data.txt, which contains 3...

    USING PYTHON PROGRAMMING LANGUAGE 15. Write code to open a file named data.txt, which contains 3 numbers, and print the sum of those numbers to the console 16. Write code that opens a file named words.txt containing an essay, and the prints out the SECOND word in the file to the console

  • Draw the flowchart of the code: Write code that opens an Excel file named area.xlsx, writes...

    Draw the flowchart of the code: Write code that opens an Excel file named area.xlsx, writes 'Radius' in cell A1, writes 'Area' in cell B1, and then using the while command populates the next 10 rows of column A (A2-A11) with the numbers 1, 2, ..., 10 and the next 10 rows of column B with the circle areas that correspond to the radii on the left. A while loop should be used.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT