2nd Web Development Tutorial : Basic Concept of PHP, HTML, MySQL, Javascript, CSS

As I mentioned in the previous post, basically, there are three main things to understand in web development.

  1. Server-side scripting (PHP, Python, Pearl, Java, C++, etc)
  2. Client-side scripting (HTML, Javascript, CSS, etc)
  3. Database (Oracle, MySQL, etc)

For server-side and database scripting, commonly, you only need to understand only one of the languages. For example, with a very simple understanding of PHP and MySQL, and a little bit of client-side scripting knowledge, you can already create a very powerful site.

As we can see in the picture above, Client Side is really in the client side, but developer must also create the code for them. This is because although we develop something in the server side, the server will process the code and send it to clients. One basic thought that we must consider is that server side script will convert itself to client side script based on how we create it to do so. So, users in the client side won’t be able to see our PHP script at all. What they see is just codes of HTML, CSS, Javascript, and other client side scripts. For instance, we create a code like this in our index.php page :

<?php
echo 'This is my beautiful website.';
?>

Whenever a user requested index.php page, the server is not going to send that code to client. Instead, PHP will convert it to client side code. In this case, the code above will convert to HTML code below.

As you can see, clients can only see HTML code, not the PHP code. They can only see other client side scripts such as javascript, CSS, and HTML. For those who wonder how to see raw HTML code as seen above, simply right click on any area in your browser, then click Inspect.

Now let’s dig in deeper into the collaboration of Server, Client, and Database scripting. Let’s create a simple PHP code below called simpleweb.php.

<!DOCTYPE html>
<html>
<head>
<style>
    table {
        width: 100%;
        border-collapse: collapse;
    }
    
    table, td, th {
        border: 1px solid black;
        padding: 5px;
    }
    
    th {text-align: left;}
</style>
<script>
  alert('Hey, JS is working here');
</script>
</head>
<body>

<?php
$con = mysqli_connect('localhost','root','','test');
if (!$con) {
    die('Could not connect: ' . mysqli_error($con));
}

mysqli_select_db($con,"test");
$sql="SELECT * FROM tb_user";
$result = mysqli_query($con,$sql);

echo "<table>
    <tr>
    <th>Firstname</th>
    <th>Lastname</th>
    <th>Age</th>
    <th>Hometown</th>
    <th>Job</th>
    </tr>";
    while($row = mysqli_fetch_array($result)) {
        echo "<tr>";
        echo "<td>" . $row['firstname'] . "</td>";
        echo "<td>" . $row['lastname'] . "</td>";
        echo "<td>" . $row['age'] . "</td>";
        echo "<td>" . $row['hometown'] . "</td>";
        echo "<td>" . $row['job'] . "</td>";
        echo "</tr>";
    }
    echo "</table>";
    mysqli_close($con);
?>
</body>
</html>

Code above contains all client side programming languages I mentioned earlier (HTML, Javascript, and CSS), and PHP and MySQL code. Let’s see how it looks like in the client side.

At first, because we added javascript in our code containing Alert function, Chrome interprets it as an alert to be shown first before showing other things. Let’s see the rest of the response it received after I clicked OK in the alert box.

From picture above, we can see that there is no more PHP or MySQL code at all. What wee see is just a bunch of HTML, Javascript, and CSS code based on how we code on PHP. The table is nicely styled in CSS, and the content is like being hard coded, although actually it is taken directly from MySQL database, which is very dynamic.

So that is a very simple understandings on how server, client, and database scripts works in web development. I recommend you to try yourself using my code above in order to understand it very well. After this, I will post another interesting topic to learn deeper about each individual languages. So, keep learning and don’t forget to code.

17,414 comments

  1. sbobet88

    Heya i am for the first time here. I came across this board and I to find It
    really helpful & it helped me out much. I’m hoping to offer something back and aid others
    like you aided me.

  2. m88 casino

    I don’t even understand how I finished up here, but I thought this submit was once good.
    I do not recognize who you might be however definitely you are going to a
    famous blogger in the event you aren’t already.

    Cheers!

  3. browse around this web-site

    І have tto thank you for the efforts you have put in penning this site.
    I am hoping tօ see tһe same hіgh-grade content byy you in the future ass
    well. In truth, your creative writing abilities has encouraged me to get my own site now 😉

  4. Codes

    I got this web site from my buddy who told me regarding this
    web paage and now this time I am visiting this website and
    reading very informative posts at this time.

  5. 카지노사이트

    Hi, I read your blogs on a regular basis. Your humoristic style is awesome, keep up the good work!

  6. chrome hearts t shirt

    It іs truily a great aand heⅼpful piece of infогmation. I’m satisfied that yoᥙ just shared this useful information wіth us.
    Pleaѕe keep us informed like this.Thanks forr sharing.

  7. beta.funtoo.org

    Ι love reading a pоѕt that can make people
    think. Also, many thanks for allowing mе to comment!

  8. casumo

    What’s up to all, how is everything, I think every one is getting
    more from this website, and your views are fastidious
    for new people.

  9. www.formale-ontologie.de

    If yⲟu desire to improve your кnoᴡledge only keep visiting
    thiѕ web site and be updatеd with the newest gossip posted here.

  10. Vaultofweird.com

    Goοd respond in reurn of ths issue with real afguments and explaining alll
    concerning that.

  11. art of war

    Generⅼly I don’t learn poset ⲟn bloɡs, but I would like to say that thhis write-up veery forced me to try and
    do it! Your wrіtіng taste has been surprised me.
    Thanks, very nice post.

  12. A-Z

    Hi outstanding website! Does running a blog like this take a lot of work?
    I have absolutely no knowledge of coding but I was hoping to start
    my own blog in the near future. Anyhow, if you have any recommendations or
    techniques for new blog owners please share. I know this is off subject but I just wanted to
    ask. Thanks a lot!

  13. instagram türk takipçi satın al

    Heya! I’m at work surfing around your blog from my new apple iphone!

    Just wanted to say I love reading your blog and look forward
    to all your posts! Carry on the fantastic work!

  14. browse around here

    Нello! I know this is ҝinda off topic nevertheless I’ԁ figured I’d ask.

    Would you be interested in exchanging links or maybe guest аuthoring a bⅼog article օor vіce-νersa?
    My sіte disxusseѕ a lot oof the same tⲟpics as yoᥙhrs and I feel we could
    grеatly bеnefit from each otһer. If youᥙ haⲣpen to be interested feel fee to send mme an e-mail.
    I look forward to hearing from үou! Great blog by the way!

  15. random[a-z

    Hello it’s me, I am also visiting this web page regularly, this website
    is really good and the visitors are in fact sharing fastidious thoughts.

  16. A-Z

    What i don’t realize is if truth be told how you are not actually a lot more well-appreciated than you may be right now.

    You’re very intelligent. You recognize thus significantly in terms of this topic, produced me individually consider it from
    a lot of various angles. Its like men and women are
    not interested until it’s one thing to do with Woman gaga!
    Your personal stuffs outstanding. At all
    times maintain it up!

  17. casino india

    We are a group of volunteers and opening a new scheme in our community.
    Your website offered us with valuable info to work on. You’ve done an impressive job
    and our whole community will be grateful to you.

  18. abogados laborales calama

    Nuestros abogados y abogadas laborales son los encargados de resarcir los derechos vulnerados de los trabajadores prestamos servicios de asesoria,
    presentamos sus demandas ante la inspección del trabajo.
    En Abogados Laborales F&D estamos a su predisposición y los atenderemos en nuestras oficinas de Iquique y Santiago.

  19. minecraft servers

    I feel that is among the such a lot significant information for me.
    And i am glad studying your article. However wanna remark on few basic things, The web site taste is perfect, the articles is truly excellent : D.
    Just right activity, cheers

  20. 바카라카지노

    It’s an amazing paragraph in support of all the online people; they will get advantage
    from it I am sure.

  21. poker rankings

    Right here is the perfect site for anyone who
    really wants to find out about this topic. You realize so much its almost tough to argue with you (not that I
    actually would want to…HaHa). You certainly
    put a brand new spin on a topic which has been discussed for
    a long time. Wonderful stuff, just wonderful!

  22. diamond art

    Hurraһ! After all I got a web site frօm where Ι be able
    to really obtain useful information concernikng my study and knowledge.

  23. 유흥알바사이트

    Disentangling the contributions of professional and individual mediators (trimming equal
    to .02).

  24. t shirt maker

    Hoԝdy! This iѕ kind of off topic but I need s᧐me guіdance
    from an established blog. Is it very haard to set up yoour own blog?
    Ӏ’m not veгy techyincal but I can figure things out pretty quіck.
    I’m thinking about cгeating my own but I’m not sure where to start.
    Do you have any ideas or suggestions? Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *