Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Why doesn't it work?

Links for php scripts

Moderators: macek, egami, gesf

Why doesn't it work?

Postby Nifty62 » Sat Jan 21, 2012 9:37 am

I have a VERY short php script, and for some reason I get a blank page. No error, no nothing.

I am fairly new to PHP, but I do have minor experience, not a ton but enough where I would think that I could write a simple variable declaration followed by echoing the variable.

Here is the code:

Code: Select all


<html>
    <head>
        <title>Variables</title>
    </head>
    
    <body>
        <?php
            $cars 
= 2;
            
            echo
($cars);
            
        ?>
    </body>
</html>



Thanks all! :-)
Nifty62
New php-forum User
New php-forum User
 
Posts: 5
Joined: Sat Jan 21, 2012 9:33 am

Re: Why doesn't it work?

Postby rupali » Sat Jan 21, 2012 7:23 pm

hello,

remove the brackets where you are printing the data, like this :

echo $cars;

:)
rupali
New php-forum User
New php-forum User
 
Posts: 140
Joined: Thu Oct 13, 2011 10:32 pm
Location: Chandigarh, INDIA

Re: Why doesn't it work?

Postby Nifty62 » Mon Jan 23, 2012 10:49 am

Ok, I changed the code so that it has no brackets.

Code: Select all

<html>
    <head>
        <title>Variables</title>
    </head>
    <body>
        <?php
            $cars 
2;  
            echo $cars;
        ?>
    </body>
</html>


Still nothing though. :-(

I also tried a simple echo 'Hello World!'; and that didn't work either
Nifty62
New php-forum User
New php-forum User
 
Posts: 5
Joined: Sat Jan 21, 2012 9:33 am

Re: Why doesn't it work?

Postby Nifty62 » Mon Jan 23, 2012 1:13 pm

Ok, it works if I type out the directory location manually, but not if I use the "run" command inside of Notepad++ or Aptana Studio.
Nifty62
New php-forum User
New php-forum User
 
Posts: 5
Joined: Sat Jan 21, 2012 9:33 am


Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.