🦘 Visiting Envato in Melbourne, Australia

[envira-gallery id=‘6841’]

November 21, 2017 · 1 min · 2 words · shelby

📈 Adding users from a CSV file to a MySQL database

I recently encountered an issue requiring me to import about 500 employees into a database and add each one to multiple departments. Using an array, I wrote some pretty simple code to import a CSV file that simply contained “username, real name” into the database. I wanted to post it in case anyone ever needed to do something along these lines. <?php include('../config.php'); $departments = array("department1", "department2", "department3", "department4"); mysql_connect("$dbhost", "$dbuser", "$dbpass") or die(mysql_error()); mysql_select_db("$dbase") or die(mysql_error()); $handle = fopen("employees.csv", "r"); while (($data = fgetcsv($handle, 5000, ",")) !== FALSE) { foreach ($departments as &$value) { $query = "INSERT INTO employees (`id`, `name`, `realname`, `tickets`, `dept`) VALUES (NULL, '$data[0]', '$data[1]', '0', '$value')"; $result = mysql_query($query) or die(mysql_error()); echo $data[1] . ' successfully added to ' . $value . ' department<br>'; } } unset($value); ?>

April 27, 2010 · 1 min · 133 words · shelby

Bad Gojo

Since I work in a factory, we have this hand soap in the bathrooms called Gojo Pumice hand soap. Besides its orange smell, it has the texture of gravel. I think that it is created locally from dirt and the local orange fields. I just had to share this.

August 12, 2005 · 1 min · 49 words · shelby

🖥️ A couple of things.

I thought after all these random Life posts, I would post some tech junk. I just got dual displays working on my box @ work… Granted, the second display is next to worthless as its runs on a shitty 8meg S3 Trio card; it lets me do 1024x768 15bit. Anything higher than that will either Not display anything Locks up the computer to the point where I have to unplug the box. All in all, it sucks and is slow as shit, but hell, it’s nice having my IM’s all on one monitor. Now, to get my FM/TV Tuner working, I might be able to make use of the second display. ...

May 27, 2005 · 1 min · 132 words · shelby