So being the sad geek I am, I decided to spend this Saturday evening making a start on learning some PHP for fun. Never written any before, only installed vb/mods and modified temples. So picked up some basic ideas of what is possible with that, but wanted to start from the begining anyway.
So, I googled for some tutorials and found some here. I read parts one and two of that, then thought I would try something out based on some of what that has shown me so far.
So here's what I did.
Doesn't work of course, I get a "
Parse error: parse error in C:\wamp\www\bob.php on line 21" from my local WAMP server when viewing it. (Which leads to related question, when apache gives a error like this, does it count blank/commented out lines? Is there anything it doesn't count?)
Line 21 just contains the closing bracket for the else statement, so not sure what is wrong there. I guess I'm just making some kind of syntax mistake, but after re-reading the examples on the linked to page, I just can't seem to see it.
Can anyone offer any advice?
Thanks.
So, I googled for some tutorials and found some here. I read parts one and two of that, then thought I would try something out based on some of what that has shown me so far.
So here's what I did.
PHP Code:
<html>
<head></head>
<body>
<?php
// define some stuff
$name = 'Bob';
$job = 'the builder';
$canhefixit = '1';
$question = 'Can he fix it?';
// check if bob can fix it or not
if ($canhefixit == '1')
{
$answer ='yes he can!';
}
else
{
$answer ='no sorry Bob can't fix this it's FUBAR';
}
echo '$name $job $question';
echo '$name $job $answer';
?>
</body>
</html>
Parse error: parse error in C:\wamp\www\bob.php on line 21" from my local WAMP server when viewing it. (Which leads to related question, when apache gives a error like this, does it count blank/commented out lines? Is there anything it doesn't count?)
Line 21 just contains the closing bracket for the else statement, so not sure what is wrong there. I guess I'm just making some kind of syntax mistake, but after re-reading the examples on the linked to page, I just can't seem to see it.
Can anyone offer any advice?
Thanks.
Comment