Jump to content

Search the Community

Showing results for tags 'fgcsv'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. I am very new to php and I have seen many posts on how to write to a csv file and several on how to fgetcsv data from a file, but none of it really makes sense and I cannot find a relevant example of what I am attempting to do. I know that most will say, use mySQL, but for this example, I really want to know how to use a csv as a data source. I have a php script that creates an image gallery from the folder that it is placed. It also gets and displays the embedded image attributes, filename, file dimensions, file size. Rather than display the file dimensions and file size, I want a corresponding csv file to display an image Category and other details from the csv. The full original php script can be viewed here: http://www.mahogan.com/gallery.txt The modified working model of this gallery can be viewed here: http://www.mahogan.com/sandbox/thumbs/gallery.php Here is a php script that gets the data from the csv: http://www.mahogan.com/sandbox/thumbs/gallery-fgetcsv.php echo "<html><body><table>\n\n"; $f = fopen("gallery-data.csv", "r"); while (($line = fgetcsv($f)) !== false) { echo "<tr>"; foreach ($line as $cell) { echo "<td>" . htmlspecialchars($cell) . "</td>"; } echo "<tr>\n"; } fclose($f); echo "\n</table></body></html>"; In my examples of the csv, this just prints the entire csv in an html table as in the file. What I do not understand is this: 1) How to Match the Filename with the thumbnail filename in the folder so that all the data in that row will stay with that filename. 2) How to assign/replace this csv data to print these in place of the image attributes. Any advice with using this CSV as a data source would be very appreciated as I really want to learn how to do this! Thanks!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.