Slice's Profile User Rating: -----

Reputation: 247 Stalwart
Active Members
Active Posts:
736 (0.29 per day)
24-November 08
Profile Views:
Last Active:
User is offline Sep 01 2015 02:11 AM

Previous Fields

OS Preference:
Favorite Browser:
Favorite Processor:
Favorite Gaming Platform:
Your Car:
Who Cares
Dream Kudos:

Latest Visitors

Icon   Slice has not set their status

Posts I've Made

  1. In Topic: Inscriptions for the future..

    Posted 1 Sep 2015

    Buried below  | 
    -1.929162     |
    -63.818492    |
  2. In Topic: Signature of the Month (August 2015)

    Posted 18 Aug 2015

    I can't believe I missed the Marvel Super Villains theme. Absoloutley devestated.

    At least I've got 10 days to dust off the ol' photoshop and attempt this one.
  3. In Topic: Fgets EOF on Linux vs Windows

    Posted 12 Apr 2015

    Usually when running import scripts like this, I avoid the browser all-together. If you have access to the command line of the server, just run "php script.php". That way you get a realtime update where you script is up to in the process. Beats the hell out of looking at a white screen that's just loading.

    Regarding your code, as CTphpnwb said, you should remove the mysql_ functions. They are depreciated and will only cause you more trouble down the line.

    You could also make better use of fgetcsv for importing csv files. Here's a quick example (not debugged, so take it as an example only) for both PDO and fgetcsv. Using prepared statements on a loop like this should also increase the speed of the script, as well as it's security.

    Line 1 is only if you want to run it from command line.

    set_time_limit(0); // if it's a large csv file
    echo "running script.php..\n"; // good output tracking for script progress in terminal
    $file = './file.csv';
    $dsn = "mysql:host=localhost;dbname=test";
        $pdo = new PDO($dsn, 'user', 'password');
    }catch(PDOException $e){
        echo "error creating pdo object: " . $e->getMessage() . "\n";
    /* create the prepared statement */
    $query = "INSERT INTO table (col1, col2, col3) VALUES (:col1, :col2, :col3)";
    $dbh = $pdo->prepare($query);
    if (($handle = fopen($file, 'r')) !== FALSE) {
        $row = 0; // i usually count rows so i can echo out how far i'm up to in the script
        echo "file opened and starting import..\n"; // echo out current stage in script
        while (($data = fgetcsv($handle, 1500, ';')) !== FALSE) {
            $array = [];
            /* add data to 'array', to be inserted into your database - $data[0] == col A on csv
             * This is where you are "binding" the data to the placeholders in the above query. 
            $array = [
               'col1' => $data[0],
               'col2' => $data[1],
               'col3' => $data[2]
                try {
                    /* insert row to database */
                    $result = $dbh->execute($array);
                }catch(PDOException $e){
                    echo "row " . $row . " FAILED: " . $e->getMessage() . "\n";
                echo "Successfully imported row " . $row . "\r";
            // inc the row
        echo "\n \n upload complete \n"; // let us know script is finished.

    Again, this is just an example code. If you are running it from terminal, the \n will produce a line break and \r will replace the current line.
  4. In Topic: Watching people code..

    Posted 9 Apr 2015

    I like learning from narrated coding videos, but I'm really picky when it comes to the narrator. If their voice is annoying, or they sound not at all interested, I get bored and just turn it off.

    Got linked to earlier today, before I saw this topic, and one of the live streams was just someone coding whilst playing music. No idea what he was doing or why.
  5. In Topic: Choosing a Pretty URL

    Posted 9 Apr 2015

    Funnily enough, I actually figured out how to route to without affecting any other routes, I just need to makesure I blacklist usernames are equal to my path names.

    If someone tries setting there unique link as "subscribers" for example, would hit my subscribers action path and display that page before hitting the wildcard.

    View PostArtificialSoldier, on 08 April 2015 - 05:50 PM, said:

    Why? Is it necessarily any easier to remember which character versus something like "profile" or "user"?

    The idea was to keep the url as short as possbile for things where characters are limited, like twitter. Users will also be able to share specific things from there account, which will make the url even longer: would link to a specific item in my profile with that ID.

    I was stuck between this and coming up with my own link shortening system, where the user could click "share" on an item, and just get a url like, which I still might offer. But I'd still like to keep it short for those who want to just copy + paste the url.

My Information

Member Title:
sudo pacman -S moneyz
25 years old
November 6, 1989
United Kingdom
web design and development

Contact Information

Click here to e-mail me


Showing 50 random friends of 7


Page 1 of 1
  1. Photo

    Slice Icon

    30 Jul 2012 - 09:45
    Do I need to collect my cash reward in person? ;)
  2. Photo

    modi123_1 Icon

    30 Jul 2012 - 09:09
    Oh.. someone got a new award!
Page 1 of 1