doddsey_65 Posted January 26, 2011 Share Posted January 26, 2011 in my attempts at PDO i seem to have gone wrong here. perhaps someone can help: $query = "SELECT * FROM ".TBL_PREFIX."users WHERE u_uid=$uid"; $stmt = $link->query($query); $result = $stmt->fetch(PDO::FETCH_ASSOC); foreach($result as $key => $val) { echo $key.' - '.$val.'<br />'; } this is the error: Fatal error: Call to a member function fetch() on a non-objec $link = new PDO("mysql:host={$settings['hostname']}; dbname={$settings['database']}", $config['database']['username'], $config['database']['password'] ); Link to comment https://forums.phpfreaks.com/topic/225704-pdo-query/ Share on other sites More sharing options...
BlueSkyIS Posted January 26, 2011 Share Posted January 26, 2011 Fatal error: Call to a member function fetch() on a non-objec please post the entire error, including one of the most important parts: the LINE NUMBER Link to comment https://forums.phpfreaks.com/topic/225704-pdo-query/#findComment-1165478 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.