Originally posted by HEAD
But I am finaly confused how PHP and MySQL work... Can somebody explaine me it in few words?
No, probably not.
It seems I read something the other day, more or less saying "if you can describe some area of knowledge in one paragraph or less, you don't understand it well enough." I'd say there's quite a bit of truth in that.
However, this is the newbies forum, so I won't trash you too badly for not using Google, nor searching this forum; I don't know for certain what's out there. Here's my sorry "attempt" at a nutshell.
PHP is a server-side scripting language designed for use on the world wide web. You must have access to a running web server (that is, a web server program must be running) in order to use PHP.
The name PHP can be loosely translated as meaning "pre hypertext processing"; it actually been denoted as the recursive acronym "PHP Hypertext Preprocessor".
You can write PHP in Notepad, or any editor that creates common text. Various "IDE" (Integrated Development Environment) programs also exist, which I imagine contain an "editor" as well as other bells and whistles. It might be possible that one would act as a sort of "local web server" to allow PHP to be interpreted without a dedicated web server, but I don't know, so don't quote me on that. Personally, I use a text editor on a local machine and upload script to a server for testing, or I open a remote shell on the server directly and edit the scripts in an editor via the (N/n)etwork.
A simple PHP script:
<?php
$name="Bob";
$servername=system("hostname");
print "
<html>
<head>
<title>Welcome to PHP on the Web Server!</title>
</head>
<body>
Hello, $name, I am a web server named $servername!
</body>
</html>
";
?>
Now, there's not much point to this script, since you could probably hard code it in HTML (although it would have a different value for $servername depending upon which machine it was being run). PHP is more useful in accepting data, say from a form, or reading it from a file (or another web site) and then doing some kind of logic before outputing HTML code to the browser/client.
Whew, now I'm tired. Somebody else can explain MySQL.... 🙂