Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A dummy wants to learn PHP.
#1
Ok, there is PHP installed on college PCs and I see many students who know it. I also seems to be something very usefull today. So I want at least to learn the basics.

Please don't just post links in here. I need those raw basic information which is very hard to find. I don't know nothing about MySQL or CGI.

So let's say for example I have some web space on a server that supports PHP. I want to make few simple PHP pages. How to start? What PHP acctually allows me and what I need to use it? What's this MySQL and do I need it to use PHP?

Help!

Thanx in advance.
Reply
#2
I don't know php neither MySQL, but AFAIK MySQL is some sort
of database stuff...
I can only give you a link but it's better than nothing: http://www.w3schools.com/
They have lots of web tutorials and learning by examples etc...
/post]
Reply
#3
Well, PHP is an integrated CGI scripting language, very similar to Perl (In fact, it started out as a Perl extension). Essentially, its a simple c-based programming language that instead of printing text to a console (like a dos box) it pumps out html. Here's an example php script. If you copied this into a file called index.php and uploaded it would run if your server supports PHP.

Code:
<?PHP
    $x = 42;

    if ($x > 10) {
        $y = 1;
    }

    print "Hello World";
?>

http://www.betterwebber.com/test/php/

Of course, that's the very basics as to what a script is. Like QB, you dont have to declare variables, and it's a pretty loose langauge. So what's it used for? Well, since you can do things like access files and databases with it, you can use it to handle forms, or retrieve databases, make forums, whatever, from a single file. Your program would pretty much generate the page you're looking at. That's the bare minimums. Really, most tutorials should get your started fine, both Perl and PHP are very easy to pick up.

Now, as for mysql, it's a database server. It lets you access a database using a query language called "sql".

example SQL query:
Code:
"SELECT column1, column2 FROM table WHERE filter ORDER BY column"

As a database language goes, it's very verstile. It's pretty much the standard interface to any database server, Oracle, mysql, whatever. PHP (and Perl) have nifty commands that let you execute strings of SQL queries, and then other commands to fetch rows of information returned one at a time.

What this lets me do is use string commands to retrieve and store information. Dont worry about this until you've gotten the hang of PHP and its coding style. Once you've done that, just PM me and I'll help you with SQL.
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#4
http://www.samods.com/~lachie/test.php

Yup, my server supports PHP. Thanx for the info. Very helpfull. I'll try to find time to mess with it.
Reply
#5
Okay. Also check and see if your server allows database servers, and if it does, does it have any tools to set up tables or servers and such for you (the tools arent necessary but they sure as hell help)?
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#6
I'm not sure. Some guy lend me a FTP account on his server. How can I check this myself?

Can a FTP manager help me in that somehow?
Reply
#7
not really. you need a username and a password to access a database server. ask the guy about it.
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#8
Lachie: here's a killer way to check your server's php capabilities...create a file called phpinfo.php and have it contain this:

Code:
<?php
   phpinfo();
?>
and view that. It will give you a big page with everything PHP is capable of; what modules are installed, etc. Great way to see if you have MySQL installed.
I'd knock on wood, but my desk is particle board.
Reply
#9
my favorite php function: the include.
in any php page, add "include('url.ext')" without double quotes and that page will be appended to the current one. works with other php pages, html, fragments, php pages with just functions, etc.

<? include('thispage.php') ?>
so wonderful.

MySQL is a godsend for quick data retrieval, but php works independantly
ammit potato!
Reply
#10
I generally tend to prefer "require" as opposed to "include" but to each their own Big Grin
I'd knock on wood, but my desk is particle board.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)