Location: PHPKode > scripts > AEYNIAS Framework > aeynias-framework/aeynias_framework/documentation/mysqL_class_usage.txt
MySQL Class Documentation.


// Validation
Purpose: to validate if a table exists.
Use: validate(string $table, array $where)
$table = the table to validate in
$where = what to look for (in array form) eg. array('firstname' => 'John', 'lastname' => 'Doe');

//quick grab
Purpose: to quickly grab data from a table
Use: quick_grab(string $table, string|array $what, array $where, [,int $use_array, string $extra]);
$table = table to look in
$where = what to look for (in array form) eg. array('firstname' => 'John', 'lastname' => 'Doe');
$what = what to grab eg. first_name, last_name, `user name`. Also, you can use an array. eg. array('first_name','last_name','user name');
$use_array = instead of just grabbing one row, this will allow you to grab more than one row, and place the results in an array
$extra = if there is anything extra to add onto the SQL Query, this is where you put it.
returns an array on success, false on on failure.

// get_row_count
Purpose: to return the amount of rows found.
Use: get_row_count(string $table, array $where [, string $extra]);
$table = table to look in
$where = what to look for (in array form) eg. array('firstname' => 'John', 'lastname' => 'Doe');
$extra = if there is anything extra to add onto the SQL Query, this is where you put it.
returns int of row count, false on failure

//insert_sql
Purpose: to insert a row into a table
Use: insert_sql(string $table, array $data);
$table = table to add row to
$data = an array of what data to add into the new row eg. array('firstname' => 'John', 'lastname' => 'Doe');
returns true if successful, false on failure

//update_sql
Purpose: to update a given row with new data
Use: update_sql(string $table, array $data, array $where [, int $auto_add]);
$table = table to look for row to update in
$data = the new data to update the row with, in array form eg. array('firstname' => 'John', 'lastname' => 'Doe');
$where = where to look for the row inside the table, in array form eg array('id' => '1');
$auto_add = optional, if set to 1 it will automatically add the row if it does not already exist. Default: 1
returns true on success, false on failure

//query
Purpose: quick way to access the mysql link
Use: query($sql);
$sql = the sql to run.
returns query data

you can access error infomration via the mysql_error() function
Return current item: AEYNIAS Framework