evanct Posted January 8, 2009 Share Posted January 8, 2009 I'm getting this error: Notice: Undefined property: stdClass::$tn_src in C:\Apache2\htdocs\gallery\functions.php on line 9 here's the code: function getPhotos() { include('login.php'); $query="SELECT id,src FROM photos ORDER BY id desc"; $result=mysql_query("$query"); if($result) { while ($row=mysql_fetch_object($result)) { $tn_src=$row->tn_src; $src=$row->src; $id=$row->id; echo '<li style="display:inline;"> <a href="view_image.php?id='.$id.'"><img src="'.$tn_src.'" alt="images" id="'.$id.'" /></a> </li>'; } } } line 9 is $tn_src=$row->tn_src; i've tried googling it, can't find a straight answer. anyone know what's going on? Link to comment https://forums.phpfreaks.com/topic/139947-undefined-property-stdclass/ Share on other sites More sharing options...
evanct Posted January 8, 2009 Author Share Posted January 8, 2009 bump? Link to comment https://forums.phpfreaks.com/topic/139947-undefined-property-stdclass/#findComment-732226 Share on other sites More sharing options...
dclamp Posted January 8, 2009 Share Posted January 8, 2009 $row is not a class. It is an array. Link to comment https://forums.phpfreaks.com/topic/139947-undefined-property-stdclass/#findComment-732232 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.