problem referencing a mysql object

From: Date: Wed, 04 Feb 2004 17:29:39 +0000
Subject: problem referencing a mysql object
Groups: php.general 
Request: Send a blank email to php-general+get-176820@lists.php.net to get a copy of this message
Hi, the problem is that I am trying to use a varible in the objects attribute name. the offending line of code is: echo "<img src='$row->cPic$count' border='1'>"; this is giving the warning: Undefined property: cPic I have tried playing with eval and variable variables to get 'cPic$count' to look like 'cPic1' before trying to use it, but nothing is working. There has to be a way to do this. Any help is greatly appreciated. -Craig while ($row = mysql_fetch_object($result)) { //other code... $count = 1; while ($count <= $row->tiPicCount) { echo "<img src='$row->cPic$count' border='1'>"; ++$count; } //other code... }

« previous php.general (#176820) next »