#2 Tutorial Pemrograman Web – Konsep Dasar PHP, HTML, MySQL, Javascript, CSS

Seperti yang telah saya jelaskan pada postingan sebelumnya, ada beberapa hal yang harus dipahami pada pemrograman web.

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

Untuk server-side dan database scripting, umumnya, kita hanya perlu belajar salah satu bahasa saja. Contoh, dengan hanya memahami PHP dan MySQL, dan sedikit pemahaman tentang client-side scripting, kita sudah bisa membuat sebuah website yang cukup powerful.

Pada gambar di atas, client side adalah program yang betul – betul ada di sisi client, namun kita sebagai developer harus membuat kode untuk client tersebut. Walaupun kita membuat kode hanya di sisi server, namun serverlah yang akan memproses kode tersebut untuk dikirimkan ke client. Program di sisi server akan mengkonversi dirinya sendiri menjadi bahasa pemrograman client-side seperti HTML, tergantung dengan bagaimana kita membuatnya di sisi server. Jadi, user yang berada di dsisi client tidak akan bisa melihat script PHP kita sama sekali. Yang bisa mereka lihat hanyalah kode HTML, CSS, Javascript, dan kode pemrograman client lainnya. Untuk lebih jelasnya, mari kita lihat contoh program PHP di bawah ini, yang filenya saya namakan dengan index.php.

echo 'This is my beautiful website.';

Ketika seorang user melakukan request ke halaman index.php, server tidak akan mengirimkan kode seperti di atas ke user tersebut. Server akan mengkonversi kode PHP di atas menjadi kode client-side. Pada contoh di atas, server akan mengkonversi kode tersebut menjadi kode HTML di bawah ini.

Seperti yang bisa kita lihat, client hanya bisa melihat kode HTML, bukan PHP. Mereka hanya melihat kode client-side seperti Javascript, CSS, dan HTML. Bagi yang penasaran bagaimana cara untuk menampilkan raw code seperti di atas, klik kanan pada halaman browser Anda, kemudian klik inspect.

Sekarang mari kita pelajari sedikit lebih dalam mengenai kolaborasi Server, Client, dan Database Script. Mari kita buat kode PHP seperti di bawah ini, kita namakan dengan simpleweb.php

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

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

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

echo "<table>
    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>";

Kode di atas mengandung semua bahasa pemrograman client side yang telah saya sebutkan sebelumnya (HTML, Javascript, dan CSS), dan juga bahasa pemrograman server dan database : PHP dan MySQL. Mari kita lihat bagaimana kode di atas jika telah diterima oleh client.

Pertama – tama, karena saya telah menyisipkan kode Javascript yang berisi fungsi Alert, Google Chrome menerjemahkannya dengan alert yang harus ditampilkan pertama kali sebelum menampilkan semua content lainnya. Sekarang mari kita lihat respon apa lagi yang akan ditampilkan ketika saya klik OK pada alert box tersebut.

Dari gambar di atas, kita dapat melihat bahwa tidak ada lagi kode PHP atau MySQL sedikitpun yang dapat dilihat oleh end user. Yang kita lihat adalah kode client side seperti HTML, Javascript, dan CSS berdasarkan bagaimana kita membuatnya di PHP. Tabel yang ditampilkan telah dimodifikasi tampilannya oleh CSS, dan isi tabelnya pun seolah – olah diketik manual pada kode yang kita buat, padahal isi tabel tersebut murni mengambil dari database MySQL yang sangat dinamis tergantung isi pada MySQL.

Itulah pemahaman mendasar mengenai bagaimana script server, client, dan database berkolaborasi di pemrograman web. Saya rekomendasikan Anda untuk mencoba sendiri program di atas untuk lebih memahaminya. Setelah ini, saya akan mengupload post mengenai pembelajaran masing – masing bahasa pemrograman secara lebih mendalam. So, keep learning and don’t forget to code.


  1. Judi poker online

    you are really a excellent webmaster. The website
    loading velocity is amazing. It seems that you’re doing any distinctive trick.
    Furthermore, The contents are masterwork. you’ve performed a wonderful activity in this topic!

  2. Online blackjack

    Hello to all, how is the whole thing, I think every one is getting more from this web site, and your views are fastidious designed for new users.

  3. signals for binary options

    Cheers a lot to this writer for your very utile report!
    It is sort of the truly useful rewarding strategy to increase the caliber of a day forex trading.
    I have got the same post about «night» technique
    with binary signs. I observe that it can also be a good
    choice for newbie investors because they just might generate increased without anxiety at night with
    this particular rewarding strategy.

  4. Joker388 online

    When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get
    four emails with the same comment. Is there any way you can remove me from that service?

    Thanks a lot!

  5. alsancak escort bayan

    I do trust all the ideas you’ve offered in your post. They are very
    convincing and can certainly work. Nonetheless,
    the posts are too short for starters. Could you please prolong them a bit from next time?

    Thank you for the post.

  6. web site

    I am really enjoying the theme/design oof your site. Do you
    ever run into any browser compatibility problems? A small number of
    my blog visitors have complained about my site not working correctly in Explorer
    but looks great in Safari. Do you have any ideas to help fix this issue?

    web site

  7. tea

    Usually I don’t learn post on blogs, however I would like to say that
    this write-up very pressured me to try and
    do it! Your writing style hass been amazed me.
    Thank you, very nice post.
    main bersamainfo bandar terpercaya

  8. homepage

    Fascinating blog! Is your theme custom made or did you download it from somewhere?
    A design like yours with a few simple adjustements would reallly make my blog shine.

    Please let me know where you got your design. Many thanks
    вакууматор профессиональный homepage
    гриль для панини

  9. Judi via pulsa

    I just like the helpful information you supply
    on your articles. I will bookmark your weblog and take a look at again right
    here frequently. I’m reasonably certain I’ll learn plenty of
    new stuff right here! Good luck for the following!

  10. Rory

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

  11. Financial Derivative

    These are actually impressive ideas in regarding blogging.
    You have touched some good points here. Any way keep up

  12. Judi via pulsa

    Hey! I just wanted to ask if you ever have any problems with hackers?
    My last blog (wordpress) was hacked and I ended up losing several weeks of hard work due to no data backup.
    Do you have any solutions to prevent hackers?

  13. Edwardo

    I used to be recommended this website by way of my cousin. I’m now not certain whether or not this publish is written by way of him
    as no one else understand such particular approximately my problem.
    You’re amazing! Thanks!

  14. hire a killer

    I read this piece of writing fully on the topic of the difference of most recent and preceding technologies, it’s amazing article.

  15. payday loans

    This is a really good tip especially to those fresh to the blogosphere.

    Brief but very accurate info… Thank you for sharing this one.
    A must read article!

  16. corona schutzmasken kaufen

    Wow that was odd. I just wrote an very long comment but after
    I clicked submit my comment didn’t show up.
    Grrrr… well I’m not writing all that over again. Anyways, just wanted to say excellent blog!

  17. Annecy

    Nice post. I learn something totally new and challenging on blogs I stumbleupon every day.

    It’s always useful to read content from other writers and use something from other websites.

  18. Agen Slot

    So many memories, this was a fantastic article.

  19. vfufpby

    great post, very informative. I’m wondering why the
    opposite specialists of this sector don’t notice this.

    You must proceed your writing. I’m sure, you
    have a huge readers’ base already!

  20. workout and diet plan

    Great website you have here but I was wanting to know if you knew of any forums that cover the same
    topics talked about here? I’d really love to be a part
    of online community where I can get comments from other knowledgeable
    individuals that share the same interest. If you have any recommendations, please let me know.
    Many thanks!

  21. Cora

    Hi there just wanted to give you a quick heads up. The text in your content seem to be running off the screen in Ie.
    I’m not sure if this is a formatting issue or something
    to do with browser compatibility but I figured I’d post to
    let you know. The layout look great though! Hope
    you get the problem solved soon. Kudos

  22. mobile app development company in India

    I think this is one of the most vital information for me.
    And i am glad reading your article. But wanna remark on few general things, The
    web site style is ideal, the articles is really great : D.
    Good job, cheers

  23. Minna

    An outstanding share! I have just forwarded this onto a colleague who has been conducting a little homework on this.
    And he actually ordered me lunch simply because I discovered it for him…
    lol. So let me reword this…. Thank YOU for the meal!!
    But yeah, thanx for spending the time to discuss this issue
    here on your internet site.

  24. UFABET

    UFADOYS เว็บพนัน คาสิโนออนไลน์ UFABET ชั้น 1

  25. Jane's Addiction

    An outstanding share! I have just forwarded this onto a friend who was conducting a little
    research on this. And he actually bought me dinner simply because I found it for him…

    lol. So let me reword this…. Thanks for the meal!! But yeah, thanx for spending the
    time to discuss this issue here on your web page.

  26. Reggie

    WOW just what I was searching for. Came here by searching for marketing

  27. Unblocked

    Excellent site. A lot of helpful info here. I am sending it to some pals ans additionally sharing in delicious.
    And certainly, thank you to your sweat!

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *