Click to See Complete Forum and Search --> : PHP Array problems - version issue?


Stuka
09-06-2001, 05:19 PM
I'm having a problem with the following code:function add_part($part){
for ($i = 0; $i < count($this->part_list); $i++){
$temp =& $this->part_list[$i];
if ($temp->pn == $part->pn){
$temp->qty += $part->qty;
return;
}
}
$this->part_list[] = $part;
print_r($this->part_list);
} This runs fine here @ work (on a Win2k/IIS setup) under PHP 4.0.6. However, when I run it on the web site (pair networks FreeBSD/Apache) under PHP 4.0.3, it does weird things. Specifically, items are being deleted from the array. Is this a known issue or change, or is there something more subtle going on here?

TIA,

Stuka

Salmon
09-06-2001, 10:49 PM
Ah Pair. They are the best.

I don't see anything in your code that would account for items being deleted from your array. But if you really think it's a version issue, you know you can compile PHP 4.0.6 for use on your Pair account right? It's pretty simple, and you need the cgi version to keep database passwords, etc secure anyway.

Stuka
09-07-2001, 12:03 AM
Actually, Salmon, I believe it was you, in another thread somewhere, that recommended them so wholeheartedly that I was forced to look into them. Honestly, I don't know WHAT is causing that weirdness, but I verified the items going missing with print_r()'s at appropriate places. As far as the db security goes, the only password I use is the read-only one, as this stuff is strictly read-only for the users (it's a product configuration sorta thingy - my first real Web work, for a serious app...almost scary, ain't it?) But I ran it on the systems mentioned, and on the Win2k it works as expected, but on the FreeBSD box, it frags...could it be a config thing? I'm sure the 2 aren't compiled identically, after all... :confused: Well, I'll do another desk-check for system issues (case sensitivity, etc.) tomorrow... :( Thanks though...if you have any brilliant insights, lemme know! :D