Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


PHP Coder required - Page 2
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

PHP Coder required

2»

Comments

  • yomeroyomero Member
    edited April 2012

    @Daniel said: <?php if $secret = 1; echo "This is NOT secret, whink, whink"; ?>

    <?=$secret==1?"This is NOT secret, whink, whink":""?>

    /troll

    Thanked by 1Roph
  • IntcsIntcs Member

    @VMPort said: Pretty much all Daniels posts are been thanked by Naruto, what the hell :P

    lol I couldn't stop laughing, his thanks are in a group other than the rest, means he is probably still banned, but he can still participate by thanking but not posting, that's just funny :D

  • netomxnetomx Moderator, Veteran

    @Intcs said: lol I couldn't stop laughing, his thanks are in a group other than the rest, means he is probably still banned, but he can still participate by thanking but not posting, that's just funny :D

    it is it's signature you fool >.>

  • IntcsIntcs Member

    @ VMPort: I guess I know a versed programmer works in php and web design as well (you might need for the programmer to your requirement for GUI), he's also 1-Does really fast work. 2-Gets a small hourly fee and overall isn't greedy. And he's from Canada I guess. (if you actually hired him, project was finished, plus you are satisfied, will I get a sort of reward then? :p)

  • IntcsIntcs Member

    @netomx said: it is it's signature you fool >.>

    O_o Sorry. I just thought it was his soul :)

  • @netomx said: forgot about the if () thing, but I dont need the {} if it is just 1 sentence :P

    Also, you put = instead of ==

  • netomxnetomx Moderator, Veteran

    @Daniel said: Also, you put = instead of ==

    Damn. It was just form my head with a los of works, I hate you now.. well, please first send me the code of the blog and then I will hate you :)

  • netomxnetomx Moderator, Veteran

    @Intcs said: O_o Sorry. I just thought it was his soul :)

    And the fool it was j/k, too. don't take it seriously!

    Thanked by 1TheHackBox
  • @netomx said: Damn. It was just form my head with a los of works, I hate you now.. well, please first send me the code of the blog and then I will hate you :)

    Heres the page controller, I hope you realise how basic it actually is

    
    <?php
    class controller
    {
        public function loadNode($page)
        {   
            if(empty($page)) { $page = "home";}
            if (!file_exists("nodes/node.$page.php")) { $page = "404";}
    
            include "nodes/node.$page.php";
            $this->node = new node;
        }
    
    
        public function nodeName()
        {
            return $this->node->PAGE_NAME;
        }
    
    
    }
    
    
    ?>
    
    
    
  • IntcsIntcs Member

    @netomx said: And the fool it was j/k, too. don't take it seriously!

    It was just fine :p

    @VMPort: I've PM'd you his info.

  • debugdebug Member
    edited April 2012

    @Daniel said: You know ideally you should be formatting it like this

    <?php >if($secret == 1) { echo "This is NOT secret, whink, whink"; } >?>

    Ideally you would not use the closing "?>" tag, as well. My (personal) preference would have been, though:

    < ?php
    if ( $secret == 1 ) {
        echo 'This is NOT secret, whink, whink';
    }
    
  • netomxnetomx Moderator, Veteran

    @Daniel said: Heres the page controller, I hope you realise how basic it actually is

    Nice, without MySQL it seems :) how about a PHP that reads the "node" directory to know how many posts are they? Seems a very good project! :)

  • MrAndroidMrAndroid Member
    edited April 2012

    @netomx said: Nice, without MySQL it seems :) how about a PHP that reads the "node" directory to know how many posts are they? Seems a very good project! :)

    <?php
    class dataBase
    {
    
        public function __construct($host, $user, $password, $database)
    
        {
        mysql_connect("$host", "$user", "$password");
        mysql_select_db("$database"); 
        }
        
        public function getTable($table, $options = "")
    
        {
        $options = mysql_real_escape_string($options);
        $data = mysql_query("SELECT * FROM $table $options");
        return $data;
        }
        public function getRecord($table, $id)
        {
        $id = mysql_real_escape_string($id);
        $data = mysql_query("SELECT * FROM $table WHERE ID = '$id'");
        $data = mysql_fetch_array($data);
        return $data;
        }
    
    }   
    
    ?>
    
    
    
    

    Since the blog script is just.... one script, only the blog node actually starts the database, its not system wide.

    And as I said, its very minimal and small, but bloody quick.

  • netomxnetomx Moderator, Veteran

    and where did you get the rich-text editor?

  • @netomx said: and where did you get the rich-text editor?

    What rich-text editor?

    http://nicedit.com/

  • netomxnetomx Moderator, Veteran

    that, thanks.

    Damn naruto, stop thanking all @Daniel posts!

    Thanked by 1TheHackBox
  • debugdebug Member
    edited April 2012

    @Daniel you should convert your scripts to either use PDO or MySQLi. Here's the main #1 reason:

    http://news.php.net/php.internals/53799

    In your __construct functons you do not need your variables in quotes. Not sure why you did that. Here's your class, rewritten to use PDO, also:

    <?php
    class Database extends PDO {
        
        public function __construct($host, $user, $password, $database) {
            $dsn = 'mysql:host='.$host.';dbname='.$database;
            parent::__construct($dsn, $user, $password);
        }
        
        /*
         * Just a note: I'm not 100% sure what you mean
         * with $options. If its a "where ## == ##" then
         * you could use prepare and execute, etc...
         */
        public function getTable($table, $options) {
            return $this->query('SELECT * FROM '.$table.' '.$options);
        }
        
        /*
         * You can make this into a one liner, but this seems easier
         * to read.
         */
        public function getRecord($table, $id) {
            $stmt = $this->prepare('SELECT * FROM '.$table.' WHERE ID = ?');
            $stmt = $stmt->execute(array($id))
            
            return $stmt->fetchAll();
        }
    }

    As a plus, this should (mostly, except for the getTable function) work with your existing code. For a bonus: If you changed how you __constructed this, you can easily change to a SQLite database, or any other DSN you want!. Wait, theres more! You have access to the PDO functions.

  • @Debug I've never used PDO or MySQLi.

    From what I can see of your rape to my code, PDO makes fetching stuff so much easier?

  • @netomx said: Damn naruto, stop thanking all @Daniel posts!

    I think he has a secret crush on me :(

    Thanked by 1TheHackBox
  • joepie91joepie91 Member, Patron Provider

    @debug said: @Daniel you should convert your scripts to either use PDO or MySQLi. Here's the main #1 reason:

    http://news.php.net/php.internals/53799

    What people seem to constantly miss is that that post is not an announcement saying that mysql_ is deprecated (which it is not, for the record), but a proposal on educating users. It does not actually state any reasons for switching to PDO, nor does it claim deprecation.

  • FranciscoFrancisco Top Host, Host Rep, Veteran

    Alright lets try to bring this back on track for Ash :)

    I'll keep an eye on IRC for anyone that's a skilled coder and looking for work.

    Francisco

  • debugdebug Member
    edited April 2012

    @Daniel said: From what I can see of your rape to my code, PDO makes fetching stuff so much easier?

    1) It's more future proof (mysql_* functions as you read are slowly being deprecated.)
    2) You're not tied to just mysql, for example you can use SQLite
    3) Was introduced in PHP 2.0, and currently only receives updates for maintenance. (http://php.net/manual/en/mysqlinfo.api.choosing.php)
    4) No MySQL 5.1+ functionality.

    Hell, look at this page

    http://php.net/manual/en/intro.mysql.php

    "This extension is not recommended for writing new code. Instead, either the mysqli or PDO_MySQL extension should be used. See also the MySQL API Overview for further help while choosing a MySQL API."

    I'm sorry if you see that as a rape of your code. :( To be fair, not much has changed, other than using objects other than functions. If you like functions, however, you can gladly use the mysqli_* functions.


    @Fran: Yup, I agree. Sorry :|


    @joepie91
    Still mysql_* functions are being discouraged. Isn't that some thing? Notice any major PHP 5.3+ (or any code done in the past year) has most likely been done in PDO or MySQLi. Also

    • Softly deprecate ext/mysql with education (docs) starting today

    As anyone knows how long it takes for the PHP team to deprecate anything, it's better to warn off new-comers from using the mysql_ functions. Same is what I'm doing right now, warning off others from using the mysql_* functions.

    Claims for deprecation: "- Not adding E_DEPRECATED errors in 5.4, but revisit for 5.5/6.0"

    Also (I'm really rambling now, sorry), but it does state reasons for PDO, specifically, "with PDO being the PHP way and main focus of future endeavors".

  • laaevlaaev Member

    I have had a positive experience hiring developers off Elance.com so you might want to consider posting a job there

  • Thank you all for your input, i think we have found our man :)

  • joepie91joepie91 Member, Patron Provider

    @debug said: Claims for deprecation: "- Not adding E_DEPRECATED errors in 5.4, but revisit for 5.5/6.0"

    It's a proposal on a mailing list, not an announcement or claim.

Sign In or Register to comment.