Mysql Select Table Data Operation

Description

Select all records from the table, short-hand function for retriving all records from table.

Function Reference :
 
       			resource/array dbGetAll(string $table_name) 
             

Parameters

Name Type Required Parameter Info Example
table_name string Yes The name of the table to select records. any table name like employee_table,user_table

Examples

 
	        <?php 
            $sdb= new SimplifiedDB(); 
            $sdb->dbConnect("localhost","username","password","dbuser"); 
            $result=$sdb->dbGetAll("users"); 
            ?> 
            

Result

Returns mysql result set by default. You can set $sdb->output_array=true, to return array as output.
If you use print_r($row) in
while($row = mysql_fetch_array($result)) {
print_r($row);
}
it will show output as in following format.

Array ( [0] => 1 [userId] => 1 [1] => Ram [username] => Ram [2] => sdf123 [password] => sdf123 [3] => Ram [firstName] => Ram [4] => Yadav [lastName] => Yadav [5] => 10 [role_id] => 10 [6] => y.ram11@gmail.com [email] => y.ram11@gmail.com [7] => Male [gender] => Male [8] => 1986-09-11 [dob] => 1986-09-11 [9] => http://www.google.com [website] => http://www.google.com [10] => Indore [city] => Indore [11] => MP [state] => MP [12] => India [country] => India [13] => 2312 [pincode] => 2312 [14] => 99229922 [phoneno] => 99229922 [15] => 90900 [faxno] => 90900 [16] => comments about user [comments] => comments about user [17] => 1985-09-11 [user_reg_date] => 1985-09-11 [18] => [visits] => ) Array ( [0] => 2 [userId] => 2 [1] => Prites [username] => Prites [2] => sdfsfds213 [password] => sdfsfds213 [3] => Pritesh [firstName] => Pritesh [4] => Gupta [lastName] => Gupta [5] => 10 [role_id] => 10 [6] => y.ram11@gmail.com [email] => y.ram11@gmail.com [7] => Male [gender] => Male [8] => 1985-09-11 [dob] => 1985-09-11 [9] => http://www.google.com [website] => http://www.google.com [10] => Indore [city] => Indore [11] => MP [state] => MP [12] => India [country] => India [13] => 2312 [pincode] => 2312 [14] => 99229922 [phoneno] => 99229922 [15] => 90900 [faxno] => 90900 [16] => comments about user [comments] => comments about user [17] => 1985-09-11 [user_reg_date] => 1985-09-11 [18] => [visits] => )

Debuging

Debug Operation Result/Output
$sdb->query SELECT * FROM `users`
$sdb->last_insert_id
$sdb->rows_affected
$sdb->message_info Connected to database
$sdb->error_info

More Examples

             
             // Another basic example, selecting all columns and rows of table 'users_roles'
             $result=$sdb->dbSelect("user_roles");