Hi mickeymouse,
mickeymouse wrote:if(isset('key')) {$key = 'key';}
I tried it but it didn't do anything for me - same error msg.
Because the way you use it, it is nonsense. isset() checks whether a variable or array key exists or not.
- Code: Select all
//correct, checks a variable
if( isset( $variable ) ) {
// ... do something
}
//correct, checks an array key
if( isset( $array['key'] ) ) {
// ... do something
}
You are trying to check a string, which should give you a new php error of type parse error:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in ...mickeymouse wrote:Here is my code:
line110: while ($row = mysql_fetch_row($Results))
line111: {$Bal[$row[4]] = ($Bal[$row[4]] - $row[3]);
line112: $Bal[$row[5]] = ($Bal[$row[5]] + $row[3]);}
Your code is weird.
The errors you get are because the $Bal[$row[4]] and $Bal[$row[5]] (the second part of the lines) are not set when you want to use them. Thats way php norices, that the array keys are undefined.
It would be much more helpful if i would now, which data is in $row, at which time they overwrite each other, etc.
The correct way would be to initialise all $Bal[] keys which are used in the while loop. But for this, i and you have to know which data is in $row[4] and $row[5].
Relating to the error messages, they have to be integers, but which task do they have? Why do you add and substitude them?
I have no idea and i am very sure there is a better way to do what you try.
mickeymouse wrote:I'm getting the correct results (as I was getting with version 1.6 of XAMPP)
but I'm getting all these messages (which I wasn't getting with 1.6)
You haven't got these messages with XAMPP 1.6 because they were suppressed. But thats not the recommend way because that way, you will never learn how to make it the right way.
mickeymouse wrote:I've also been getting msgs like this
Notice: Undefined variable: Bal ...in line 111
but I got rid of these by defining $Bal=0; at the beginning of my code.
Thats good. Even better would be to initialise $Bal as an empty array instead of 0. like this:
- Code: Select all
$Bal = array();
mickeymouse wrote:However, is there a way of turning off all this kind of verification?
My coding is correct and these checks & msgs are just a nuisance.
No, your code is not correct. But PHP has got a really good failure tolerance. Thats the only reason why your code still works.
Other programming languages act the other way till your code is absolute correct.
best wishes,
Altrea