Posted By

shawntysco on 09/22/10


Tagged

mysql php query


Versions (?)

Query the database PHP


 / Published in: PHP
 

URL: linkdeo.net

To use: $updatesql = querys($sql); or $selectsql = getresult($sql);

Used simplify selecting rows from a database. You'll need to pass in the SQL statement.

  1. /*FUNCTION: querys
  2.  *PURPOSE: querys the database
  3.  *RETURNS: $rs - result set
  4.  */
  5. function querys($sql){
  6. $rs=mysql_query($sql);
  7. return $rs;
  8. }
  9. /*FUNCTION: get result
  10.  *PURPOSE: querys the database, adds to assicoative array
  11.  *REUTRNS: $data - assocative array
  12.  */
  13. function getresult($sql){
  14. $rs=mysql_query($sql);
  15. $data=@mysql_fetch_array($rs);
  16. return $data;
  17. }

Report this snippet  

You need to login to post a comment.