SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: PHP problem

  1. #1
    SitePoint Member
    Join Date
    Jul 2002
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP problem

    Hi All,

    I just installed MySQL IIS, and PHP on a Server2000 machine. When I try to look at the first PHP example in Kevin Yank's book, what I get is a blank page. When I view source, it shows the code mostly correctly. The second field in his code appears incorrectly but otherwise looks fine.

    His example is:

    <html>
    <head>
    <title>Today's Date</title>
    </head>
    <body>
    <p>Today's Date (according to this web server) is
    <?php

    echo( date("l, F ds Y.") );

    ?></p>
    </body>
    </html>

    I think the F variable isn't working right because I keep getting random numbers when I access this file. I think PHP is working, sort of, but just doesn't display.

    I've gone over the installation processes at least 5 or 6 times and I'm starting to get blurry eyed. I don't see any mistakes anywhere.

    Anybody have any ideas?

    Thanks for any help in advance.

    KarateEd......:-)

  2. #2
    SitePoint Member
    Join Date
    Aug 2003
    Location
    USA
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try changing to the following:


    <?php

    echo( date("l, F d Y." ) );

    ?>

    What does the output look like when you access it? Where are the random numbers located? etc..

    jd

  3. #3
    SitePoint Member
    Join Date
    Jul 2002
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jdanner
    Try changing to the following:


    <?php

    echo( date("l, F d Y." ) );

    ?>

    Thanks, that solves one problem.

    What does the output look like when you access it? Where are the random numbers located? etc..

    The random numbers are gone now...but when I access it, I just get a blank screen. It's when I 'View Source' that I see the expected results. Very baffling. KarateEd......:-)

    jd

  4. #4
    SitePoint Member
    Join Date
    Aug 2003
    Location
    USA
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Start at the top and check to make sure that you have all of your tags and quotes closed.

    The actually code part runs fine and if you are able to view the source and it is there we know it's being processed correctly.

    In my experience this problem is usually due to a simple error in the HTML coding, example:

    <html>
    <head>
    <title>My Title</title <--Title tag not closed off properly.
    </head>

    Check for this sort of thing. If you still can't find it post a link to the page or the entire source ( if it isn't to big ) so we can see what is happening.

    jd

  5. #5
    SitePoint Member
    Join Date
    Jul 2002
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post

    Start at the top and check to make sure that you have all of your tags and quotes closed.

    Actually, I've done this several times. This bit of coding is all there is to the page because I'm just learning about PHP, SQL and database design. I'm not too bad at HTML and have done way longer code than this by hand with no problem....however, that being said, there is still something not quite right so I'll check again as you suggest. Thanks:......

    The actually code part runs fine and if you are able to view the source and it is there we know it's being processed correctly.

    I agree, it appears that the code is being correctly interpreted. So it's probably not PHP doing the job wrong.

    In my experience this problem is usually due to a simple error in the HTML coding, example:

    I also agree with this statement, thought I had checked it thoroughly, but maybe there's a goofy character somewhere that, because I put it in, can't see....again, Thanks JD......:-)

    <html>
    <head>
    <title>My Title</title <--Title tag not closed off properly.
    </head>

    Check for this sort of thing. If you still can't find it post a link to the page or the entire source ( if it isn't to big ) so we can see what is happening.

    It's only the size of the original source that I typed in with the first question. So, if I don't find the problem, I'll be happy to have someone see what happens (which is just a blank screen, no text, no pictures, nada).

    At lease I know that MySQL is working properly.Everything Kevin Yanks said in his book about that worked, just not the PHP script (and it's only a one liner).

    Currently, I'm at work but will be home in 6 hours or so, and will do this.

    Again, I really appreciate your help, it does help to have a second set of eyes on problems, even small ones like this....Thanks......

    KarateEd.....:-)

  6. #6
    SitePoint Member
    Join Date
    Jul 2002
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good news.

    Problem is solved. The book used double quotes around the PHP portion of the date variables. It should be single quotes. That was the main reason the page was blank. Everything is working fine now.

    Thanks very much for your help JD...:-)

    KarateEd


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •