Learn PHP or MySQL First

Discussion in 'PHP' started by minnseoelite, Jan 21, 2007.

  1. #1
    Ok I have been designing static html and css websites for some time now and am wanting to expand into PHP and MySQL databases. Now I don't have the time to learn both at the same time so I was wondering if I should go about learning PHP or MySQL first.....

    I know that with MySQL you can set up your tables enter in you data and click "generate PHP code" to automatically get your PHP code for your site but that leaves me with a code that I dont really know what everything does.

    Any suggestions or tips......
     
    minnseoelite, Jan 21, 2007 IP
  2. fsmedia

    fsmedia Prominent Member

    Messages:
    5,163
    Likes Received:
    262
    Best Answers:
    0
    Trophy Points:
    390
    #2
    You should most definitely learn PHP first because you can't use MySQL without PHP so it would be worthless to try to learn MySQL first.
     
    fsmedia, Jan 21, 2007 IP
  3. jcyprich

    jcyprich Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi minnseoelite. You should learn PHP first but you can also learn MySQL at the same time. There are PHP books that teach how to use both. You might want to take a look at Wrox Publishing books on PHP, i.e. Beginning PHP 5. In this book, you will learn PHP programming and MySQL programming as well.

    Johan Cyprich
     
    jcyprich, Jan 21, 2007 IP
  4. MattD

    MattD Peon

    Messages:
    161
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I disagree - learn SQL first (just generic stuff - doesn't have to be MySQL specific), then try PHP. SQL is really really really easy to learn (for the basics anyway) so it will take a few hours tops to get going.

    The reason I say this is because without a database there is only so much you can do with PHP. Yeah so you can do some simple stuff, but you aren't going to be able to do anything that is that relevant to web-design without a database. PHP is a larger subject anyway, so it will take a lot longer to master.

    If you have a database ready and waiting when you start with PHP, you can get some real results right away. Otherwise you could be sitting there trying to learn how to access and display data from a database in PHP, but without a database or knowing what SQL statement to use, you aren't going to get very far (until you learn SQL anyway)!

    Oh and you can use MySQL for so much more than PHP! :)
     
    MattD, Jan 21, 2007 IP
  5. fsmedia

    fsmedia Prominent Member

    Messages:
    5,163
    Likes Received:
    262
    Best Answers:
    0
    Trophy Points:
    390
    #5
    And I disagree with that statement. There is SO much you can do without a database. Databases help, yes, a lot, but there is tons and tons of stuff out there you can do that doesn't require a database.

    It really depends on what you want to start learning first and how you want to get into it.

    If you want to develop locally, this is a good easy startup tool

    http://www.apachefriends.org/en/xampp.html
     
    fsmedia, Jan 21, 2007 IP
  6. MattD

    MattD Peon

    Messages:
    161
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Yeah there is a lot you can do, but in the context of making a data-driven website (which is what I assume the OP is wanting), you cant do much without a database.

    Ideally you'd just do both - its not like SQL requires any significant effort to learn.
     
    MattD, Jan 21, 2007 IP
  7. fsmedia

    fsmedia Prominent Member

    Messages:
    5,163
    Likes Received:
    262
    Best Answers:
    0
    Trophy Points:
    390
    #7
    There's something I do agree with. With a data-driven site, you do need a database.
     
    fsmedia, Jan 21, 2007 IP
  8. jcyprich

    jcyprich Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Why not just study Beginning PHP 5 by Wrox? You'll learn PHP and along the way learn SQL and MySQL. You'll learn enough in that book to build database driven web sites. If you want more after that, read a book on SQL or MySQL on its own.

    Johan Cyprich
     
    jcyprich, Jan 21, 2007 IP
  9. projectshifter

    projectshifter Peon

    Messages:
    394
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #9
    I think this is a really bad way to look at it, it isn't really two separate programming languages so to speak. SQL syntax is QUITE easy, and there are only a few things you're going to need to know to get started. PHP is the actual language part that you're going to need.
    $query = mysql_query("SELECT * FROM <table> WHERE param1='value'");
    $id = mysql_result($query, 0, 'id');
    or 
    while ($e = mysql_fetch_array($query)){
        echo 'Result '.$e['id'].' = '.$e['anotherColumnName'].'<br />';
    }
    
    Code (markup):
    Honestly that's going to be the bulk of the php code you're going to need to interact with MySQL or any other SQL database for a while. Start by designing a couple tables, inserting the data manually, and learn to pull from it. php.net is a wonderful resource, just look up the stuff there and you'll find plenty of helpful comments. SQL is a quick thing, and PHP is a LOT more than just grab and pull from a database.
     
    projectshifter, Jan 21, 2007 IP
  10. minnseoelite

    minnseoelite Peon

    Messages:
    845
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Ok thanks everyone and I was asking as I wanted to be able make my own myspace resource sites and admin cp instead of using the same old overused scripts out there so I guess I would be learning admin cp programming and the site's PHP would basically just be fetching and displaying thumbnail images and the likes.
     
    minnseoelite, Jan 21, 2007 IP