WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : A simple function for loading an array with an object
Categories : PHP, Arrays Update Picture
Joshua Minnie
Date : Mar 06th 2002
Grade : 2 of 5 (graded 6 times)
Viewed : 7395
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Joshua Minnie
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

<?
// Function for loading an array with an object. I tried loading the array by
// setting $event_object equal to the object, which didn't seem to return the right
// values for later use.
// I ended up pushing objects (using array_push($_name_of_array_,
// $_object_or_value_to_push_) ). This enable me to use the return the $event_list
// array in a usable form.

function getEvents($filename) {
//string $filename
$event_list = array();
$event_object = new event();
$i = 0;

@ $fp = fopen($filename, "r");
if(!$fp) {
echo "<p><strong>Cannot open ".$filename." for reading mode...</strong></p>";
exit;
}

while(!feof($fp)) {
$temp = fgetcsv($fp, 1024, ":");
if(!$temp) break;
$event_object->init($temp[0],$temp[1],$temp[2],$temp[3],$temp[4],
$temp[5],$temp[6],$temp[7],$temp[8]);
if(!array_push($event_list, $event_object)) break;
}
fclose($fp);

return $event_list;
}

// If anyone is interested in seeing the entire class definition, just let me know
// by emailing me at josh@acsurf.net



Single-file PHP news system with automatic folder structure creation
Categories : PHP, Filesystem, Arrays
Parsing html tags with php. Get an array from this function
Categories : PHP, HTML and PHP, Arrays, Tag Extractors
Takes an array and returns a string, suitable for inputing in an SQL statement
Categories : Arrays, Strings, PHP
Query2Report : Generating Html, Pdf and Csv Reports from SQL Query
Categories : PHP, PHP, HTML, PDF, Excel
Check for functional file links (broken Files)
Categories : PHP, Data Validation, FTP, Regexps, Arrays
Grab images from one or more URLs and save them to a specified local directory.
Categories : PHP, Filesystem, Strings, Arrays
How to Get a character array from a string
Categories : PHP, Strings, Arrays
PHP Dump in html format the contents of one array variable with a recursive list of the nested array variables inside.
Categories : PHP, Arrays, Variables
This functions makes it easy to use session-variables known from ASP. With one Cookie the array "session" will save and restore from a db-record. In this version MySQL is used but it's should very easy to change
Categories : PHP, Arrays, Cookies, MySQL, Databases
Simple PHP Bar Graph using GD library
Categories : PHP, GD image library, Graphics, Arrays
A class to put get and post variables in hidden form elements. Works on scalars, normal arrays, associative arrays.
Categories : Algorithms, Variables, Arrays, PHP, PHP Classes
Weighted Random - Random Scripts usually chose one out of each item, and each item have an equal chance to be chosen. But what if you want an item to be chosed more frequently than other?
Categories : PHP, Math., Arrays
Function that returns an array with the 7 dates of the week that belong to the supplied date.
Categories : PHP, Date Time, Arrays
Human readable PHP password generator
Categories : PHP, Security, Beginner Guides, Arrays
How to pass an array to a function, or how to define a function wich recieves an array.
Categories : Variables, PHP, Arrays