SitePoint Sponsor

User Tag List

Results 1 to 19 of 19
  1. #1
    SitePoint Addict betrollwin.com's Avatar
    Join Date
    Nov 2005
    Posts
    213
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP problem - nothing is showing

    http://pastebin.ca/392649

    Read notes to the right of <--------------------------------

    I've been trying stuff for a good hour, cant figure anything out.

  2. #2
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You've a syntax error and error reporting turned off. The error is missing closing parenthesis here:
    PHP Code:
    if(isset($_COOKIE['join'])){ 
    Saul

  3. #3
    SitePoint Addict betrollwin.com's Avatar
    Join Date
    Nov 2005
    Posts
    213
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, got past that but its still not completely working...

    How do I turn on error reporting?

  4. #4
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    error_reporting(2039);

    The number means what level you want it at. Look it up.

    Once it's on PHP should tell you what line the error is on.

  5. #5
    SitePoint Addict betrollwin.com's Avatar
    Join Date
    Nov 2005
    Posts
    213
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Raffles View Post
    error_reporting(2039);

    The number means what level you want it at. Look it up.

    Once it's on PHP should tell you what line the error is on.
    Made a simple php error page to see if this works and it doesnt

    PHP Code:
    <?php
    error_reporting
    (6143);
    $hide 1;
    if(
    $hide == 1){
    echo 
    "error";
    echo 
    "error2";

    ?>
    Page comes up empty.

    http://pastebin.ca/392696 <------ updated notes

  6. #6
    SitePoint Enthusiast wyte raven's Avatar
    Join Date
    Feb 2007
    Location
    England, High Wycombe Bucks
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Of course it doesn't, you don't have a closing brace for your if clause.
    Wyte R@ven - Creator of the Rift

  7. #7
    SitePoint Addict betrollwin.com's Avatar
    Join Date
    Nov 2005
    Posts
    213
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wyte raven View Post
    Of course it doesn't, you don't have a closing brace for your if clause.
    have you read any of the previous post?

  8. #8
    SitePoint Enthusiast -tcwd-'s Avatar
    Join Date
    Mar 2005
    Location
    Toronto, ON, Canada
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://pastebin.ca/392696 <------ updated notes
    you can't have the
    Code:
    echo "passes";
    on line 61. You cannot parse anything in between an elseif { } and else { statement.
    - Edward Sun ..blog.. printdoublesided
    Potential client demands a portfolio, but you don't have one? ...
    Easily create your own portfolio!

  9. #9
    Grumpy Minimalist
    Join Date
    Jul 2006
    Location
    Ontario, Canada
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In your php.ini file, find the line that includes "error_reporting", and change it to "error_reporting = E_ALL | E_STRICT".

    Just below, change the "display_errors" line to "display_errors = On".

    This assumes that you are using your own server, and not renting hosting. If that is the case, you may be able to achieve the same result using Apache's .htaccess file.

    Never do this on a publicly accessible server!

  10. #10
    SitePoint Zealot Bill Palmer's Avatar
    Join Date
    Oct 2005
    Location
    London, UK
    Posts
    148
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you ARE on a public server and don't have php.ini access, just go to http://whatismyip.com and add this to the top of the page:

    PHP Code:
    if($_SERVER['REMOTE_ADDR'] == "put your ip address here") {
            
    error_reporting(E_ALL E_NOTICE);

    Easy enough.

  11. #11
    SitePoint Enthusiast wyte raven's Avatar
    Join Date
    Feb 2007
    Location
    England, High Wycombe Bucks
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by betrollwin.com View Post
    Made a simple php error page to see if this works and it doesnt

    PHP Code:
    <?php
    error_reporting
    (6143);
    $hide 1;
    if(
    $hide == 1){
    echo 
    "error";
    echo 
    "error2";

    ?>
    Page comes up empty.

    http://pastebin.ca/392696 <------ updated notes
    You said this piece of code doesn't display anything, it won't because you don't have a closing brace. I did read the rest of your post but was unable to figure out your problem. But was able to figure out why this simple piece of code wouldn't display anything.
    Wyte R@ven - Creator of the Rift

  12. #12
    SitePoint Enthusiast -tcwd-'s Avatar
    Join Date
    Mar 2005
    Location
    Toronto, ON, Canada
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wyte raven View Post
    You said this piece of code doesn't display anything, it won't because you don't have a closing brace. I did read the rest of your post but was unable to figure out your problem. But was able to figure out why this simple piece of code wouldn't display anything.
    He is using that piece of code to test his error_reporting();.. if it works, a Fatal Error would be displayed.. but according to him, nothing is outputted.
    - Edward Sun ..blog.. printdoublesided
    Potential client demands a portfolio, but you don't have one? ...
    Easily create your own portfolio!

  13. #13
    SitePoint Wizard simplecode's Avatar
    Join Date
    Jun 2006
    Posts
    1,129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    error_reporting(E_ALL);

  14. #14
    Dinah-Moe Humm mudshark's Avatar
    Join Date
    Dec 2003
    Posts
    1,072
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    By the way: you don't need a custom sentenceCase() function, look up ucwords in the manual.

  15. #15
    SitePoint Addict betrollwin.com's Avatar
    Join Date
    Nov 2005
    Posts
    213
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Tarh View Post
    In your php.ini file, find the line that includes "error_reporting", and change it to "error_reporting = E_ALL | E_STRICT".

    Just below, change the "display_errors" line to "display_errors = On".

    This assumes that you are using your own server, and not renting hosting. If that is the case, you may be able to achieve the same result using Apache's .htaccess file.

    Never do this on a publicly accessible server!
    Not my server, on a host. Had it on for a while, then they went down and came back up and low and behold, no error reporting

    Quote Originally Posted by Bill Palmer View Post
    If you ARE on a public server and don't have php.ini access, just go to http://whatismyip.com and add this to the top of the page:

    PHP Code:
    if($_SERVER['REMOTE_ADDR'] == "put your ip address here") {
            
    error_reporting(E_ALL E_NOTICE);

    Easy enough.
    Tried it, still shows up blank when there is an error.

    Quote Originally Posted by -tcwd- View Post
    He is using that piece of code to test his error_reporting();.. if it works, a Fatal Error would be displayed.. but according to him, nothing is outputted.
    Correct

    Quote Originally Posted by simplecode View Post
    error_reporting(E_ALL);
    Tried it. no cigar

    Quote Originally Posted by mudshark View Post
    By the way: you don't need a custom sentenceCase() function, look up ucwords in the manual.
    Will look into it, seems a lot easier than the function.

    Still can't find that damn error

    EDIT 2 SECONDS LATER: found the problem, had two else statements D'oh!

  16. #16
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    The problem with your main script was found by tcwd way back in post8.

    Your lines

    PHP Code:
            }elseif(!preg_match($regexp$email)){
                    echo(
    "Your email seems to be incorrect!");
            }
    echo 
    "passes";
    else{ 
    need to be changed to

    PHP Code:
            }elseif(!preg_match($regexp$email)){
                    echo(
    "Your email seems to be incorrect!");
            }else{ 
    you cannot have the echo statement between the closing bracket and the else statement.
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  17. #17
    Grumpy Minimalist
    Join Date
    Jul 2006
    Location
    Ontario, Canada
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The problem is that the sample error you posted is a compile-time error, so the script errors out before the call to turn on error reporting ever occurs.

    This may not be the optimal solution, but I've used this to find compile-time errors like this on a server with error reporting off.

    If I'm testing index.php, and need to view it with error reporting on, I create a file called index.debug.php, and fill it with this:
    PHP Code:
    <?php
    if($_SERVER['REMOTE_ADDR'] == "put your ip address here") {
            
    error_reporting(E_ALL E_NOTICE);
            
    ini_set('display_errors','On');
            require_once(
    'index.php');
    }
    ?>
    This will turn error reporting on, and then include the file to debug. That way, even compile-time errors will be displayed. Of course, you may want to tweak this to accept the page to load in the query string. If that is the case, make sure that only you have access to this, or you may risk your entire server. Especially make sure that you have set your open_basedir if you decide to do such a thing.

  18. #18
    SitePoint Zealot Bill Palmer's Avatar
    Join Date
    Oct 2005
    Location
    London, UK
    Posts
    148
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tarh, that's a great idea.

  19. #19
    SitePoint Addict betrollwin.com's Avatar
    Join Date
    Nov 2005
    Posts
    213
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Tarh View Post
    The problem is that the sample error you posted is a compile-time error, so the script errors out before the call to turn on error reporting ever occurs.

    This may not be the optimal solution, but I've used this to find compile-time errors like this on a server with error reporting off.

    If I'm testing index.php, and need to view it with error reporting on, I create a file called index.debug.php, and fill it with this:
    PHP Code:
    <?php
    if($_SERVER['REMOTE_ADDR'] == "put your ip address here") {
            
    error_reporting(E_ALL E_NOTICE);
            
    ini_set('display_errors','On');
            require_once(
    'index.php');
    }
    ?>
    This will turn error reporting on, and then include the file to debug. That way, even compile-time errors will be displayed. Of course, you may want to tweak this to accept the page to load in the query string. If that is the case, make sure that only you have access to this, or you may risk your entire server. Especially make sure that you have set your open_basedir if you decide to do such a thing.
    We've got a winner. Thanks to all.


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
  •