The Conservative Cave

The Help Desk => Computer Related Discussions & Questions => Topic started by: SSG Snuggle Bunny on April 04, 2012, 10:50:42 AM

Title: Apache/php
Post by: SSG Snuggle Bunny on April 04, 2012, 10:50:42 AM
Trying to learn php.

I DL'ed and installed WAMP and it appears to be running correctly.

I open my notepad and type the following, per the instructions of my "How-To" book:

Code: [Select]
<?php
echo  "<table border=\"1\" cellpadding=\"4\" cellspacing=\"4\">n";
for (
$y=1$y<=12$y++) {
echo "<tr> \n";
for ($x=1$x<=12$x++) {
echo "<td>";
echo ($x $y);
echo "</td> \n";
}
echo "</tr> \n";
}
echo 
"</table>";
?>

The book says to save it as a .php file and put it in the document directory and then open using a web browser.

However, when I open using FF or IE all I get is the above code.

I even tried throwing html-head-body tags around it.


So what did I miss?
Title: Re: Apache/php
Post by: Maxiest on April 04, 2012, 10:53:42 AM
Did you name it index.php?
Title: Re: Apache/php
Post by: SSG Snuggle Bunny on April 04, 2012, 11:02:47 AM
Did you name it index.php?

Das Book says to name it: testnestfor.php because it's teaching the nesting of loops.
Title: Re: Apache/php
Post by: Maxiest on April 04, 2012, 11:11:20 AM
Das Book says to name it: testnestfor.php because it's teaching the nesting of loops.

Yeah I guess you can do that too.

And you have IIS or Apache installed on your test machine?
Title: Re: Apache/php
Post by: SSG Snuggle Bunny on April 04, 2012, 11:36:38 AM
Yeah I guess you can do that too.

And you have IIS or Apache installed on your test machine?

Yep. Apache.

And it is running...near as I can tell.

I'm not really trying to be a server admin. I'm trying to learn mySQL, XML, JavaScript etc. but to do that I need an Apache-esque server to run the documents thru.
Title: Re: Apache/php
Post by: Maxiest on April 04, 2012, 11:45:25 AM
Yep. Apache.

And it is running...near as I can tell.

I'm not really trying to be a server admin. I'm trying to learn mySQL, XML, JavaScript etc. but to do that I need an Apache-esque server to run the documents thru.

Yes you do.  I don't see anything wrong with your code.
Title: Re: Apache/php
Post by: LC EFA on April 10, 2012, 02:30:11 AM
When I was learning PHP I had to install a MySQL server ,  PHP  (http://windows.php.net/download/) Server and Apache server. All were free downloads and all ran on the same machine.
Title: Re: Apache/php
Post by: CactusCarlos on April 10, 2012, 10:01:42 AM
Trying to learn php.

I DL'ed and installed WAMP and it appears to be running correctly.

I open my notepad and type the following, per the instructions of my "How-To" book:

Code: [Select]
<?php
echo  "<table border=\"1\" cellpadding=\"4\" cellspacing=\"4\">n";
for (
$y=1$y<=12$y++) {
echo "<tr> \n";
for ($x=1$x<=12$x++) {
echo "<td>";
echo ($x $y);
echo "</td> \n";
}
echo "</tr> \n";
}
echo 
"</table>";
?>

The book says to save it as a .php file and put it in the document directory and then open using a web browser.

However, when I open using FF or IE all I get is the above code.

I even tried throwing html-head-body tags around it.


So what did I miss?

Not versed in php at all but do you have to chmod php scripts so that they're executable?