|
|
 |
Author |
Message |
Supremacy

Joined: 29 Apr 2007
Posts: 3
|
Posted:
Sun Apr 29, 2007 3:21 pm |
  |
Hi,
When I code in PHP, everything works fine until I use an IF statement. WHen I use one of them, the whole page comes out blank on my computer, and there is nothing wrong with the coding.
Show errors is on and everything, it happens when I use an IF statement.
Please help
Sup |
|
|
  |
 |
lku homer

Joined: 29 May 2006
Posts: 104
|
Posted:
Sun Apr 29, 2007 10:25 pm |
  |
Well something is obviously wrong with the code unless your if statement tells it to be blank. I'm not trying to insult you, but there must be. And it makes it hard for anyone to help when there is no code to look at. |
|
|
      |
 |
Supremacy

Joined: 29 Apr 2007
Posts: 3
|
Posted:
Mon Apr 30, 2007 7:26 am |
  |
Ive coded for over 2 years in PHP and I can tell you nothing is wrong. Even this simple code does not work.
Code: |
<?php
$num = 3
if($num == 3){
echo('Hi');
}else{
echo('Bye');
}
?> |
Even that doesnt work, all coding works until I use IF and ELSE or even just IF. |
|
|
  |
 |
dale

Joined: 11 Jun 2006
Posts: 51
Location: las vegas, nv
|
Posted:
Thu May 03, 2007 8:05 am |
  |
If you add the ; to the line
$num = 3
it works. |
|
|
  |
 |
Supremacy

Joined: 29 Apr 2007
Posts: 3
|
Posted:
Thu May 03, 2007 5:57 pm |
  |
-_-
Im talking bout the if statement, that was example coding.
Any ideas? |
|
|
  |
 |
dale

Joined: 11 Jun 2006
Posts: 51
Location: las vegas, nv
|
Posted:
Fri May 04, 2007 6:49 am |
  |
Why don't you try to use debuging in the php part. Just go to your php.ini file and change
display_errors = Off
to On
so that you can see where the errors are. Since your sample code had an error, maybe there might be an error will just pop up. Without having the real code to look at, it is impossible for anyone else to see what could be wrong.
By the way, if you correct your sample code and run it does it work?
There is also a log file in the php folder where the errors are stored. You might want to look in there to see if there isn't a function that isn't turned on that needs to be turned on. |
|
|
  |
 |
invisible-root

Joined: 01 Jun 2007
Posts: 7
|
Posted:
Fri Jun 01, 2007 8:26 am |
  |
What you need is to gather more information about the problem. PHP will never tell you what's wrong if you haven't asked it. To do that you can edit php.ini (as mentioned earlier by dale) or this:
Code: |
<?php
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
// rest of your code here...
?>
|
You might also be interested in http://php.net/ini_set and http://php.net/error_reporting
I strongly recommend when you write code, to have error_reporting set to E_ALL (so you will be informed about all errors ie undefined variables etc...) and display_errors = On. Do that only on your local server and not on a live webserver because if an attacker can see these information, he/she might be able to hack your application. Be careful with these things.
Hope that helps. |
|
|
  |
 |
|
|
View next topic
View previous topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
Powered by phpBB
© 2001, 2002 phpBB Group :: FI Theme
All times are GMT
|