Source for file sql_tools.php

Documentation is available at sql_tools.php

  1. <?php
  2. // ----------------------------------------
  3. // ultra simplified version
  4. // updated by Alain : Tue Dec 04 2007
  5. // ----------------------------------------
  6.  
  7. function process_sql($query, &$result, &$total) {
  8. //global $connexion, $Database;
  9. $result = mysql_query($query) or die("IN $query >> " . mysql_error());
  10. $total = mysql_affected_rows();
  11. }
  12.  
  13.  
  14. // ---------------------------------------------
  15. // read_data
  16. // return record value in an array
  17. // for record id of any table
  18. // optional where clause
  19. // ---------------------------------------------
  20.  
  21. function read_data($table, $record_id, $where = "") {
  22. $table_id = $table . '_id';
  23. $qre = "select * from $table
  24. where $where $table_id = '$record_id'
  25. ";
  26.  
  27. $rre = mysql_query($qre);
  28. $array_res = mysql_fetch_array($rre);
  29. return $array_res;
  30. }
  31.  
  32. ?>

Documentation generated on Mon, 31 Mar 2008 18:09:00 +0200 by phpDocumentor 1.3.0RC3