Why cannot phpforeach access PHPcode $ RSQL = sprintf (self: GETQATT, $ CID); $ us = $ this-& gt; mysql-& gt; getData ($ RSQl ); e. why cannot php foreach access?
PHP code
$RSQL=sprintf(self::GETQATT,$CID); $us=$this->mysql->getData($RSQl); echo $RSQL; $uc=count($us); if($uc>0) { foreach($us as $u) { echo $u['UID']; } }
$ Why can't foreach access when uc is clearly greater than 0?
------ Solution --------------------
Print_r ($ us); check out
------ Solution --------------------
Output $ us before foreach
PHP code
If ($ uc> 0) {print_r ($ us); foreach ($ us as $ u) {echo "# TEST #"; echo $ u ['uid'];}
------ Solution --------------------
Discussion
$ Why can't foreach access when uc is clearly greater than 0?
------ Solution --------------------
That is, there is a problem with the database connection. check it.
------ Solution --------------------
$ Us = $ this-> mysql-> getData ($ RSQl );
Print_r ($ us); // Paste the result to see
------ Solution --------------------
Discussion
No problem. if there is anything, how can $ uc be greater than 0?