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.

620 comments

  1. https://routersettings.site/

    Hi there, after reading this awesome piece of writing i
    am too glad to share my familiarity here with mates.

  2. for g

    Hi to all, the contents existing at this website are truly remarkable
    for people knowledge, well, keep up the good work fellows.

  3. g year

    Good day very nice site!! Man .. Beautiful .. Superb ..
    I will bookmark your site and take the feeds also? I’m happy to find numerous helpful
    info right here within the put up, we’d like work out more techniques on this regard, thanks for sharing.
    . . . . .

  4. g first

    Just desire to say your article is as astounding. The clearness in your post is just spectacular and i could
    assume you’re an expert on this subject. Well with your permission let me to grab your feed to keep up to date with forthcoming post.
    Thanks a million and please continue the gratifying work.

  5. playonly.me

    Hi great website! Does running a blog such as this
    take a large amount of work? I’ve virtually no knowledge of coding however
    I had been hoping to start my own blog soon. Anyways, if you have
    any recommendations or techniques for new blog owners please share.
    I understand this is off subject nevertheless I
    simply wanted to ask. Cheers!

  6. eduranz.com

    Hey! I know this is kind of off topic but I was wondering which blog platform are you using for this site?
    I’m getting tired of WordPress because I’ve had
    problems with hackers and I’m looking at alternatives for another platform.
    I would be fantastic if you could point me in the direction of a
    good platform.

  7. tinyurl.com

    Usually I don’t learn article on blogs, but I would like to say that this write-up very pressured
    me to try and do so! Your writing style has been amazed me.
    Thanks, quite nice post.

  8. cbd oil that works 2020

    This post is in fact a nice one it assists new the web
    viewers, who are wishing for blogging.

  9. cbd oil that works 2020

    WOW just what I was searching for. Came here by searching for cbd oil that works 2020

  10. cbd oil that works 2020

    This article will assist the internet viewers for setting up new
    web site or even a weblog from start to end.

  11. cbd oil that works 2020

    Hi there, I do think your website may be
    having browser compatibility problems. When I take a look at your website in Safari, it looks fine but when opening in IE, it has some overlapping issues.
    I just wanted to provide you with a quick heads up! Besides that, excellent website!

  12. hosting services

    I read this piece of writing completely on the topic of the
    comparison of latest and earlier technologies, it’s awesome article.

  13. cbd gummies near me

    I’m the manager of JustCBD Store brand (justcbdstore.com) and am trying to develop my wholesale side of company. It would be great if someone at targetdomain give me some advice ๐Ÿ™‚ I thought that the very best way to accomplish this would be to connect to vape stores and cbd stores. I was really hoping if someone could recommend a trusted web site where I can purchase CBD Shops B2B Marketing List I am presently checking out creativebeartech.com, theeliquidboutique.co.uk and wowitloveithaveit.com. Not exactly sure which one would be the most suitable solution and would appreciate any assistance on this. Or would it be easier for me to scrape my own leads? Ideas?

  14. website hosting

    Woah! I’m really enjoying the template/theme of this website.

    It’s simple, yet effective. A lot of times it’s tough to get that “perfect balance” between user friendliness and visual
    appearance. I must say you have done a amazing job with this.
    Additionally, the blog loads super fast for me on Chrome. Superb Blog!

  15. website hosting

    I read this piece of writing completely about the difference of most
    recent and preceding technologies, it’s remarkable article.

  16. best web hosting 2020

    Your style is really unique compared to other people I have read
    stuff from. Many thanks for posting when you’ve got
    the opportunity, Guess I’ll just bookmark this web site.

  17. best hosting

    Hi there Dear, are you really visiting this web site on a regular basis, if so after that you will absolutely get good knowledge.

  18. international flights

    Wow, fantastic blog layout! How long have you
    been blogging for? you made blogging look easy.
    The overall look of your site is excellent, as well as the content!

  19. hosting services

    This is a really good tip particularly to those fresh to the blogosphere.
    Simple but very accurate infoโ€ฆ Appreciate your sharing
    this one. A must read article!

  20. web hosting reviews

    Its like you read my mind! You seem to understand a lot approximately
    this, like you wrote the ebook in it or something. I think
    that you just can do with some p.c. to force the message house a little bit, however instead of that, this
    is excellent blog. An excellent read. I’ll certainly be back.

  21. web host

    It is in reality a great and helpful piece of info.
    I’m glad that you simply shared this useful info
    with us. Please stay us informed like this. Thanks
    for sharing.

  22. web hosting service

    I must thank you for the efforts you’ve put in writing this blog.

    I really hope to view the same high-grade content from you later on as
    well. In fact, your creative writing abilities has encouraged me to
    get my very own website now ๐Ÿ˜‰

  23. adreamoftrains website hosting services

    Hello there! I could have sworn I’ve been to this site
    before but after browsing through some of the post I realized it’s new to me.
    Nonetheless, I’m definitely happy I found it and I’ll be bookmarking and checking back often! adreamoftrains web hosting company

  24. web hosting providers

    Terrific post however , I was wanting to know if you could write a litte more on this subject?
    I’d be very thankful if you could elaborate a little bit further.
    Kudos!

  25. best web hosting sites

    I am genuinely grateful to the owner of this web site
    who has shared this wonderful paragraph at at this place.

  26. web hosting services

    Hello all, here every one is sharing these experience, therefore it’s nice to read this webpage, and I used to pay a visit this web
    site everyday.

  27. best web hosting

    I am regular reader, how are you everybody? This paragraph posted at this
    website is truly nice.

  28. cheap flights

    Howdy very cool blog!! Man .. Excellent .. Superb ..

    I will bookmark your website and take the feeds additionally?
    I’m glad to search out numerous helpful information right here in the post, we need
    work out more strategies in this regard, thank you for sharing.
    . . . . .

  29. cheap flights

    Thanks for a marvelous posting! I seriously enjoyed reading it,
    you happen to be a great author.I will make sure to bookmark your blog and will often come back in the foreseeable
    future. I want to encourage continue your great work, have a nice afternoon!

Leave a Reply

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