Bin will be removed on June 1, 2014 in favor of http://gist.github.com. Please save all your pastes before then. So long, and thanks for all the fish!×
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//Model
class susers extends AppModel
    {
        /**
         * Which dbConfig to use, defined in database.php
         * @var string
         */
        public $useDbConfig = "service";
        /**
         * Which table the model belongs to
         * @var mixed (string,boolean)
         */
        public $useTable = 'users';
 
        public function getAll()
        {
            /*
            $sql = 'select * from users';
            $res = @mysql_query( $sql );
            $users = array();
            if ( $res !== FALSE )
            {
                while ( $row = @mysql_fetch_array( $res ) )
                {
                    $users[] = $row;
                }
            }*/
            $users = $this->findAll();
            $out['success'] = false;
            $count = 0;
            $u = array();
            foreach( $users as $user )
            {
                $count++;
                $u[] = array(
                    'id' => $user['susers']['id'],
                    'name' => $user['susers']['username'],
                    'password' => $user['susers']['pwd'],
                    'fullname' => $user['susers']['full_name'],
                    'email' => $user['susers']['email'],
                    'notes' => $user['susers']['notes']
                );
            }
            $out['users'] = $u;
            $out['count1'] = $count;
            $out['success'] = true;
 
            return $out;
        }
    }
 
//I have another users table in a different database in the same application so I created a new modelname, that I try to use in the controller where the model has a __PHP_Incomplete_Class_Name class reference.