I'm trying to pull info off of a db and store it in an array. $row
is returning information, while $categories
is lazy and doesn't do anything. There's a log warning on the server that says:
PHP Notice: Undefined index: CATID in /www/zendsvr/htdocs/public/test/index.php on line 29
CATID
is auto-increment PK from about 1 to 1100. I've also assigned $row
entries to individual variables successfully, but this array just doesn't want to work.
$query = 'SELECT CATID, CATDSC, CATPID, CATFEAT, CATURL FROM cecart.categories
WHERE CATURL!=\'\' ORDER BY CATFEAT DESC, RAND()';
while (($row = $stmt->fetch(Zend_Db::FETCH_ASSOC)) !== false) {
$categories[$row['CATID']] =
array('CATID' => trim($row['CATID']),
'CATDSC' => trim($row['CATDSC']),
'CATPID' => trim($row['CATPID']),
'CATFEAT' => trim($row['CATFEAT']),
'CATURL' => ($cat_img_dir . trim($row['CATURL'])));
print($row['CATID'] . ' | ' . $categories['CATID']); // line 29
}
line 29 outputs: x | should be x | x if the array was working properly