Documentation is available at sql_tools.php
- <?php
- // ----------------------------------------
- // ultra simplified version
- // updated by Alain : Tue Dec 04 2007
- // ----------------------------------------
- function process_sql($query, &$result, &$total) {
- //global $connexion, $Database;
- $result = mysql_query($query) or die("IN $query >> " . mysql_error());
- $total = mysql_affected_rows();
- }
- // ---------------------------------------------
- // read_data
- // return record value in an array
- // for record id of any table
- // optional where clause
- // ---------------------------------------------
- function read_data($table, $record_id, $where = "") {
- $table_id = $table . '_id';
- $qre = "select * from $table
- where $where $table_id = '$record_id'
- ";
- $rre = mysql_query($qre);
- $array_res = mysql_fetch_array($rre);
- return $array_res;
- }
- ?>