2Moons 1.8 DataBase class

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • 2Moons 1.8 DataBase class

      Users who use 2Moons 1.8.git , how do you use function to count rows ? I tried to use db->rowCount() but it always gives me value 1. No matter if there is data in table or not. 2moons 1.8 DB class seems limited to some options, or I just do not use it correct ?
    • $Var = Database::get()->selectSingle('SELECT COUNT(*) as count from table where something = :something, array(
      ':something' => something you want
      ), 'count');

      everytime you call the $Var now, you get the # of rows. make sure the red ones have same name.
    • If you want specific sql commands with SELECT, selectSingle is your friend.

      No problem, glad could give a hand.