cleary1981 Posted July 24, 2008 Share Posted July 24, 2008 what is wrong with this code? the error i am getting is <br /> <b>Fatal error</b>: Cannot use object of type stdClass as array in <b>C:\wamp\www\listModules.php</b> on line <b>8</b><br /> heres my php <?php require "config.php"; // database connection details $sql="select module_name, mod_desc from module where confirmed='0'"; $result = mysql_query($sql) or trigger_error(mysql_error()); $row = mysql_fetch_object($result); $return = $row['module_name']."%". $row['mod_desc']; echo $return; ?> Link to comment https://forums.phpfreaks.com/topic/116383-solved-cannot-use-object-of-type-stdclass-as-array/ Share on other sites More sharing options...
MasterACE14 Posted July 24, 2008 Share Posted July 24, 2008 change this: $row = mysql_fetch_object($result); to this: $row = mysql_fetch_array($result); Regards ACE Link to comment https://forums.phpfreaks.com/topic/116383-solved-cannot-use-object-of-type-stdclass-as-array/#findComment-598455 Share on other sites More sharing options...
cleary1981 Posted July 24, 2008 Author Share Posted July 24, 2008 D'oh!! thanks Link to comment https://forums.phpfreaks.com/topic/116383-solved-cannot-use-object-of-type-stdclass-as-array/#findComment-598458 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.