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'] ); Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/225704-pdo-query/#findComment-1165478 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.