WEB i have been able to get my head around html/css/javascript/xml

Discussion in 'OT Technology' started by drpepper, Oct 8, 2009.

  1. drpepper

    drpepper Active Member

    Joined:
    Nov 13, 2006
    Messages:
    38,076
    Likes Received:
    2
    Location:
    San Antonio
    ... but PHP just fucking owns me. I can not get my head around it. I've read books, gone through W3 tutorials, everything. I know the premise behind it and how it works, i just cant seem to code a working application with it.

    Anyone have better learning resources?
     
  2. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    Might help to pick up a beginners programming book. Something not php specific.
     
  3. Kevin

    Kevin New Member

    Joined:
    Aug 27, 2002
    Messages:
    87,634
    Likes Received:
    0
    Location:
    Michigan
    That was gonna be my suggestion.

    Assuming you have no formal training, take a college course in OO programming theory, or get a book. You need to fully understand the paradigm of objects first.

    Then PHP will be a breeze, just gotta learn the syntax and quirks.
     
  4. Kevin

    Kevin New Member

    Joined:
    Aug 27, 2002
    Messages:
    87,634
    Likes Received:
    0
    Location:
    Michigan
    This is like trying to build a turbo charger with no knowledge of how a motor works. Start at the start.
     
  5. Kevin

    Kevin New Member

    Joined:
    Aug 27, 2002
    Messages:
    87,634
    Likes Received:
    0
    Location:
    Michigan
    O Reilly books are some of the best. Pick up an O Reilly PHP book.
     
  6. Kevin

    Kevin New Member

    Joined:
    Aug 27, 2002
    Messages:
    87,634
    Likes Received:
    0
    Location:
    Michigan
    4 in a row!
     
  7. brds

    brds OT Supporter

    Joined:
    Jun 26, 2006
    Messages:
    17,643
    Likes Received:
    14
    Location:
    Atlanta
    Start off with small simple projects. Simple form processing, data checking, ect. From there, move on to mysql shit. Look at tutorials/examples on line and learn as you do. That's what i did like 7 or 8 years ago. Now it's all just second nature.

    That being said, i still need to learn JS :mamoru:
     
  8. drpepper

    drpepper Active Member

    Joined:
    Nov 13, 2006
    Messages:
    38,076
    Likes Received:
    2
    Location:
    San Antonio
    anyone have a book recommendation? (amazon link/etc)
     
  9. drpepper

    drpepper Active Member

    Joined:
    Nov 13, 2006
    Messages:
    38,076
    Likes Received:
    2
    Location:
    San Antonio
    ive actually been able to create a registration script using php + a mysql db
    but anything more complicated is just beyond me. objects, classes, functions, etc. holy shit...
     
  10. brds

    brds OT Supporter

    Joined:
    Jun 26, 2006
    Messages:
    17,643
    Likes Received:
    14
    Location:
    Atlanta
    For those, i had to start with stealing other people's and editing them as necessary. Do that enough, and you'll get the hang of it.
     
  11. fishbulb

    fishbulb Active Member

    Joined:
    Oct 29, 2001
    Messages:
    6,848
    Likes Received:
    4
    Location:
    md
    This is where reading a book and learning Object Oriented program will really help. If you learn to do this right from the get go, things will be much easier later on and you'll spend a lot less time maintaining/fixing your code.
     
  12. hank85

    hank85 sudo shred /dev/sda -f -v -z --iterations=6

    Joined:
    Jul 23, 2008
    Messages:
    4,360
    Likes Received:
    0
  13. brds

    brds OT Supporter

    Joined:
    Jun 26, 2006
    Messages:
    17,643
    Likes Received:
    14
    Location:
    Atlanta
    .


    At first, the concept of functions, objects, and classes seems a bit much. Much if you take it slowly with each one, it should prove to be quite easy.
     
  14. pharmokan

    pharmokan OT Supporter

    Joined:
    Oct 18, 2002
    Messages:
    102,161
    Likes Received:
    436
    Location:
    L.A.
    YOU MAD DUMB SON
     
  15. pharmokan

    pharmokan OT Supporter

    Joined:
    Oct 18, 2002
    Messages:
    102,161
    Likes Received:
    436
    Location:
    L.A.
  16. Coaxsist

    Coaxsist Re-create... Innovate

    Joined:
    Feb 11, 2008
    Messages:
    1,032
    Likes Received:
    0
    Nice... will read up later...
     
  17. Pepsi1975

    Pepsi1975 Mod of the Year

    Joined:
    Jan 6, 2005
    Messages:
    47,590
    Likes Received:
    0
    Location:
    Detroit
    spam it and you will get a ban
     
  18. Supergeek

    Supergeek New Member

    Joined:
    Jan 23, 2007
    Messages:
    1,855
    Likes Received:
    0
    Location:
    Colorado
    The reason you're probably having a problem is you're treating PHP like a static HTML page instead of a program. Even Javascript is static in the sense that they are loaded by the client, then the client decides what to do. PHP does all of its decision-making on the server, and then gives it to the client.

    PHP scripts are programs that *generate* HTML. You run them, they spit out HTML as a product. It's like BASIC or C++. You can't treat a PHP file the same as an HTML file. It's a whole different point of view.
     
  19. drpepper

    drpepper Active Member

    Joined:
    Nov 13, 2006
    Messages:
    38,076
    Likes Received:
    2
    Location:
    San Antonio
    cool

    see anything wrong with this code?

    Code:
    <?php
    
    if (isset($_POST['submit']));
    
        {    
            $age = $_POST['age'];
            if ($age < 21)
                {
                    echo "Youre not 21 yet.";
                }
            if ($age >= 21)
                {
                    echo "Youre over 21!";
                }
        }
            
    else {
            echo "<form action=\"<?php echo $_POST[PHP_SELF] ?>\" method=\"POST\" /><br />";
            echo "What is your age?: <input type=\"text\" name=\"age\" /><br />";
            echo "<p><input type=\"submit\" name=\"submit\" value=\"submit!\" /></p>";
        }
    ?>
    
    error: Parse error: syntax error, unexpected T_ELSE in /home/xxxx/public_html/test.php on line 17
     
    Last edited: Oct 10, 2009
  20. drpepper

    drpepper Active Member

    Joined:
    Nov 13, 2006
    Messages:
    38,076
    Likes Received:
    2
    Location:
    San Antonio
    thanks man, it worked.
     

Share This Page