[PHP-DB] RE: php: $array[fieldname] gives undefined index err
** Reply to note from Jonathan Hilgeman [EMAIL PROTECTED] Fri, 22 Jun 2001 14:44:57 -0700 Jonathan asks: Whats your query look like? Do you perform any joins? $query = SELECT * FROM $table WHERE CustNo='$CustNo'; Pretty vanilla stuff. [ . . . ] BUT! If the field is NULL, php spits out this: Warning: Undefined index: Website in f:\website\pmaco\admin\contacts1.php on line 241 The offending line was: if ($row[Website]) { // do stuff } and is now: if (!is_null($row[Website])) { if (strlen($row[Website])) { // do stuff } } Same warning msg. But if I substitute a numberic index, as in: if ($row[33]) { // do stuff } it works fine. But I need to use the associative index. Regards, Al S. -- * Hillman other Rootes Group manuals online: http://asavage.fdns.net/Hillman * Ford Falcon manuals online: http://FalconFAQ.fdns.net My computer is no longer a virgin; it's lost its Himem+ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] RE: php: $array[fieldname] gives undefined index err
** Reply to note from Jonathan Hilgeman [EMAIL PROTECTED] Fri, 22 Jun 2001 14:44:57 -0700 Jonathan asks: Whats your query look like? Do you perform any joins? Hmmm . . . everything after $query got chopped off, and didn't display in the digest version I received. Well, I'll try again: * $query = SELECT * FROM $table WHERE CustNo='$CustNo';* I put it on two lines above, with a leading * and trailing *, so lets see if it shows up this time, eh? Pretty vanilla stuff. [ . . . ] Summary: associative index does not work, triggers Warning: Undefined index: Website [...] but numeric index works. Regards, Al S. -- * Hillman other Rootes Group manuals online: http://asavage.fdns.net/Hillman * Ford Falcon manuals online: http://FalconFAQ.fdns.net Do not disturb. Already disturbed, thankyouverymuch. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]