Thread: PHP Basic Query

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    1
    Rep Power
    0

    PHP Basic Query


    Hi,

    I am new person to PHP. Just using XAMPP V3.2.1. I have created two small scripts.

    1.
    <html>
    <head>
    <title>PHPPROG1 php</title>
    </head>
    <body>
    <?php
    # operator
    print "<h2>php program to add two numbers...</h2><br />";
    $val1 = 20;
    $val2 = 20;
    $sum = $val2 + $val2; /* Assignment operator */
    echo "Result(SUM): $sum";
    ?>
    </body>
    </html>

    2.
    <html>
    <head>
    <title>Hello World</tile>
    </head>
    <body>
    <?php
    echo "Hello World!";
    ?>
    </body>
    </html>

    The second script is showing a blank page in browser while 1st script is showing correct result. Any idea what could be the reason? Both look almost same.

    regards
    Atul
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    2
    Rep Power
    0
    dear you can check your spelling of html tags !
    the spelling of title is wrong check and correct it first and then try again it will work . thanks
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Dec 2004
    Posts
    2,868
    Rep Power
    368
    use PHP tags and you may see some errors highlighted. use a proper editor to edit, it will help you.

    what are the names of the script? remember files need to end with .php!
  6. #4
  7. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,921
    Rep Power
    1045
    kavin_brown already solved the problem: There was a typo in the closing title, which caused all content to appear in the title rather than on the page.

    But using an editor or even an IDE is certainly a good idea, especially if you have trouble with splelnig.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".

IMN logo majestic logo threadwatch logo seochat tools logo