Hey guys, I know this is a simple question but I don't think, how do i query the amember database. An example of what I put (from http://www.amember.com/docs/API/Db): require_once LIBRARY.'Am/Lite.php'; require_once LIBRARY.'Am/Di.php'; $users = Am_Di::getInstance()->db->select("SELECT * FROM ?_user WHERE state=? LIMIT ?d", 'NY', 10); I got this error: Fatal error: Class 'sfServiceContainerBuilder' not found in/home/justin/public_html/premium/library/Am/Di.phpon line164 I found out that in Di.php, "class Am_Di extends sfServiceContainerBuilder" No idea why this class (sfServiceContainerBuilder) was not included...
You mixes 2 different API: lite and full. Do the following instead: PHP: ini_set('display_errors', true); // for debug timerequire_once '/path/to/amember/bootstrap.php';$di = Am_Di::getInstance(); // get a shortcut$users = $di->userTable->findByState('NY');foreach ($users as $user){ // got an array of User objects echo $user->login;}// or another try$users = $di->db->select("SELECT * FROM ?_users WHERE state=? LIMIT ?d", 'NY', 10);// got array of MySQL records (arrays)var_dump($users);
I deleted my file and copy and pasted the exact code. There seems do be something wrong with bootstrap.php. I'm pretty sure I got the right path to file. I got the following error... Script Error An internal error happened in the script, please contact webmaster for details When I uncomment bootstrap the php and all the code after it, there is no error.
Make sure that you have no php output or html code before this line: require_once '/path/to/amember/bootstrap.php'; aMember starts session from bootstrap.php and if you have HTML code before this, script will generate an error.