Closed Thread Icon

Topic awaiting preservation: PHP: undefined index error using error_reporting(E_ALL); (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=26711" title="Pages that link to Topic awaiting preservation: PHP: undefined index error using error_reporting(E_ALL); (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: PHP: undefined index error using error_reporting(E_ALL); <span class="small">(Page 1 of 1)</span>\

 
Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 09-24-2005 00:08

Greetings! I've cranked up error_reporting using error_reporting(E_ALL); and I've resolved all issues except one. I seem to be getting:

"Notice: Undefined index: long in ...."

I get it a couple of times. The lines of code that it refers to are:

code:
$sql = "update psor_offenders set latitude = '" . $mapData[0]['lat'] . "', longitude = '" . $mapData[0]['long'] . "' where id = '$rows[id]'";
if ($mapData[0]['lat'] != '' && $mapData[0]['long'] != ''){



The script runs fine, and there are no problems, other than the error message. I inserted

code:
$mapData = '';

higher up, but that didn't resolve it. I tried single quoting the 0, but that didn't help either. The $mapData items DO have value....

What am I missing here?

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 09-24-2005 09:34

You're accessing map data as an array of arrays.
You're storing in it a string - that has to break ;-).

try
$mapData = array(array("lat' => '', 'long' =>''))

or how about doing a var_dump($mapData) rigth before the sql and see what's really in there?

« BackwardsOnwards »

Show Forum Drop Down Menu