Forum Moderators: coopster
I developed and deployed a site about a year ago using php 4.4.1 (I think). All tested well and ran perfectly both locally as well as live.
Now, this client wants me to do some maintenance on a few of his pages, but when I started previewing pages (locally) that I haven't even touched yet, I'm getting error notices all over the place like:
"Notice: Undefined variable: name in c:\apache\htdocs\danielik\guest\guestbook_sign.php on line 108", and:
"Notice: Use of undefined constant NAME_ERROR - assumed 'NAME_ERROR' in c:\apache\htdocs\danielik\guest\validate_guest.php on line 10"
Wow, what happened?
The only thing that changed is that I got a new hard drive and reinstalled a new(er) version of php (4.4.2) as well as apache.
I've googled the problem with a lot of hits but nothing that works for me to remedy this issue - I've turned on register_globals (which I didn't want to do) but still the same errors - so I turned it back off and tried again with same aggravating result.
On the live site (no maintenance has been uploaded yet) it still works perfectly so I'm at a real loss.
Is it some php configuration issue that I haven't dealt with?
All guidance HUGELY appreciated.
Neophyte
Appreciate the insight, but this either means that I had error reporting turned off on my previous install of php or something else wierd is going on.
My aim is to write code that is as error free as possible so - while I'm happy to be alerted to the error(s), I'm losing sleep over how to fix it.
Here's one code snippet (which is at the very top of the page) that's causing one of the "undefined variable" errors:
<?php
require_once '../_include/db.query.inc.php';
foreach($_POST as $key => $value){
$arr = explode("_", $key);
$buttonHit=$arr[0];
$rowId=$arr[1];
}
if ($buttonHit == 'Edit') {
$query="SELECT id, name, email
FROM email
WHERE id = $rowId";
$result = dbQuery($query, TRUE);
$viewRows = mysql_fetch_assoc($result['recs']);
$rowId=$viewRows['id'];
$name=$viewRows['name'];
$email=$viewRows['email'];
include ('rates.edit.php');
exit();
}
?>
The error throws at the line "if ($buttonHit == 'Edit')", and names $buttonHit as the undefined variable.
Any clues as to the error of my ways? Does one now (or atleast since v4.4.1) have to declare/define variables?
Neophyte