PHP / MySQL

Image

PHP is a programming language (♦ see DEF.multiplatform and object oriented, created in 1994.

It allows you to create Dynamic Web Pages on a HTTP server.

MYSQL is a relational database management system (RDBMS), regularly associated with PHP.

Code Examples

We start with very simple codes. The more you progress, page after page, the more sophisticated the scripts will be.

C 0001 - Hello World !

Say hello...

<!DOCTYPE html>
<html>
<body>
<?php
echo "Hello World !";
?>
</body>
</html>

 

⇒ See the results

Reproduce this code, choosing one of the compilers below (♦ See DEF.) (don't copy-paste! It would be too easy). They have the same function, just pick up one according to your preferences.

When you copy your code, replace the existing code (by default) with your own.

Warning ! For some of these compilers, you might have to choose the programming language yourself, in a specific menu which is offered to you. Of course, don't forget to click on RUN !

For some of the compilers marked *, copy the part between the tags <?php and ?>, including of course the tags. Some HTML tags may appear raw, if you do not integrate the code in its entirety within a .php page.

C 0002 - Playing with values

Use variables...

<!DOCTYPE html>
<html>
<body>
<?php
$color = "green";
echo "My basket is " . $color . "<br>";
$color2 = "red";
echo "My book is " . $color2 . "<br>";
?>
</body>
</html>

 

⇒ See the results

Reproduce this code, choosing one of the compilers below (♦ See DEF.) (don't copy-paste! It would be too easy). They have the same function, just pick up one according to your preferences.

When you copy your code, replace the existing code (by default) with your own.

Warning ! For some of these compilers, you might have to choose the programming language yourself, in a specific menu which is offered to you. Of course, don't forget to click on RUN !

For some of the compilers marked *, copy the part between the tags <?php and ?>, including of course the tags. Some HTML tags may appear raw, if you do not integrate the code in its entirety within a .php page.

C 0003 - Playing with variables

Use the numbers...

<!DOCTYPE html>
<html>
<body>
<?php
$txt = "Hello, see the results !";
$x = 50; $y = 10.5;
echo $txt; echo "<br>";
echo $x; echo "<br>";
echo $y;
?>
</body>
</html>

 

⇒ See the results

Reproduce this code, choosing one of the compilers below (♦ See DEF.) (don't copy-paste! It would be too easy). They have the same function, just pick up one according to your preferences.

When you copy your code, replace the existing code (by default) with your own.

Warning ! For some of these compilers, you might have to choose the programming language yourself, in a specific menu which is offered to you. Of course, don't forget to click on RUN !

For some of the compilers marked *, copy the part between the tags <?php and ?>, including of course the tags. Some HTML tags may appear raw, if you do not integrate the code in its entirety within a .php page.

C 0004 - Playing with numbers

A small calculation...

<!DOCTYPE html>
<html>
<body>
<?php
$x = 50;
$y = 65;
echo $x + $y;
?>
</body>
</html>

 

⇒ See the results

Reproduce this code, choosing one of the compilers below (♦ See DEF.) (don't copy-paste! It would be too easy). They have the same function, just pick up one according to your preferences.

When you copy your code, replace the existing code (by default) with your own.

Warning ! For some of these compilers, you might have to choose the programming language yourself, in a specific menu which is offered to you. Of course, don't forget to click on RUN !

For some of the compilers marked *, copy the part between the tags <?php and ?>, including of course the tags. Some HTML tags may appear raw, if you do not integrate the code in its entirety within a .php page.

Info+

Creation
» Creation date: 1994
* Created by Rasmus Lerdorf
* Developed by The PHP Group

* Influenced by C/C ++, Java and PERL
* Written in C

* Cross-platform
* Free license / PHP license

Practical cases

In order to train you, we add small programs every week to this section in order to keep you up to speed.

CASE 1

BASIC LEVEL

Create a form (newsletter)

This small program will allow you to create a form, offering the possibility to a website's visitor to subscribe to a newsletter.

TRY

CASE 2

INTERMEDIATE LEVEL

Create and manage a database (catalog)

This small kit will allow you to conceive and develop a database managing a catalog's products, then presenting it on a Web page.

TRY

CASE 3

EXPERT LEVEL

Create a website

Design and develop a complete classical website, including different types of forms.

TRY
2021 (C) Fond of Code tm (protected trademark) - Reflex001 / Diego Piccini (da Todi).
All rights reserved. Protected editorial content (www.theethicalweb.com).

About Us...

About Us...
Reflex001

Web
Programming
Development

Main Topics

Main Topics

Legal/Support

Legal/Support
Image