qmqmqm Posted February 26, 2009 Share Posted February 26, 2009 Ihave the following code: function query($connection, $query_string){ $result = $connection->query(); if (MDB2::isError($result)){ die("Could not query the database:<br />".$query_string." ".MDB2::errorMessage($result)); } return $result; } $query = "SELECT * FROM profiles WHERE id=$id"; $result = query($connection, $query); I get the following error: "Warning: Missing argument 1 for MDB2_Driver_Common::query(), called in..." If I query directly: $query = "SELECT * FROM profiles WHERE id=$id"; $result = $connection->query($query); if (MDB2::isError($result)){ die("Could not query the database:<br />".$query." ".MDB2::errorMessage($result)); } Then there is no error. Does anyone know why this is? Thanks, Tom Quote Link to comment https://forums.phpfreaks.com/topic/147026-function-call-error-using-pear-mdb2-library/ Share on other sites More sharing options...
premiso Posted February 26, 2009 Share Posted February 26, 2009 $result = $connection->query(); You are missing the $query parameter....you need to put $query_string inside that. Quote Link to comment https://forums.phpfreaks.com/topic/147026-function-call-error-using-pear-mdb2-library/#findComment-771881 Share on other sites More sharing options...
qmqmqm Posted February 26, 2009 Author Share Posted February 26, 2009 Thank you very much premiso ! Quote Link to comment https://forums.phpfreaks.com/topic/147026-function-call-error-using-pear-mdb2-library/#findComment-771982 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.