PDA

View Full Version : Learning PHP: Does anybody know any good resources?


Test Zero
19 Apr 2008, 13:40
Already know HTML; want to start learning PHP for a project I'm working on.

Does anyone know of any decent books/websites that I can learn from?

Cheers.

SupSuper
19 Apr 2008, 14:21
I learned it on my own from references and examples, but you can try http://www.w3schools.com/PHP/php_intro.asp

MrBunsy
19 Apr 2008, 15:27
W3schools and http://www.tizag.com/phpT/ worked well for me, although I already knew a fair amount of javascript, so scripting wasn't completely new to me. I don't know how easy it would be to use it to learn from scratch.

AndrewTaylor
19 Apr 2008, 19:11
I found the reference at php.net was very good. Clear, well-written, comprehensive, and usually with loads of user-submitted examples, very few of which are ****. I don't know if it would be a good starting point, but certainly a good bookmark.

Do you know any other programming languages? If you do then PHP should be fairly easy to learn -- it lets you get away with a lot more than most.

Test Zero
19 Apr 2008, 21:10
Yeah, I have some experience with VB. Enough to get by.

I've installed Apache and PHP (manually). Apache's working fine. HTML is being processed, but PHP isn't.

What's going on? Any ideas?

MrBunsy
19 Apr 2008, 21:30
The latest version of PHP should set itself up to run in apache automatically, it asked me where apache's conf dir was.

Otherwise, here's what's in my apache config file, which should be all you need to add.

PHPIniDir "C:/Program Files/PHP/"
LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll"

If that's already there, a reboot ought to get it working.

bloopy
21 Apr 2008, 00:08
If you have some idea of what PHP function you want to use in a particular situation, php.net is really handy for looking it up, as you just type php.net/ followed by the function name, and you get a bunch of user-posted examples, eg. http://php.net/str_replace

Test Zero
21 Apr 2008, 05:55
OK, got PHP working, but no luck connecting it to MySQL.

I use this:
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>

... but neither the "die" nor "echo" commands execute.

Any ideas?

Edit: It's getting stuck on the $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); line. Nothing (neither PHP nor HTML) is being processed after this.

MrBunsy
21 Apr 2008, 11:32
Have you tried running phpinfo() and checking that php is actually using the mysql extension? If it's not you'll have to manually add it in php.ini, and check that the dll is in the ext dir.