File: db.php

package info (click to toggle)
dojo 1.10.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 97,980 kB
  • ctags: 10,348
  • sloc: php: 10,616; xml: 3,429; java: 3,098; sql: 928; sh: 484; pascal: 205; perl: 182; makefile: 77; python: 45; sed: 37; ruby: 10
file content (18 lines) | stat: -rw-r--r-- 436 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php

function db_query() {
  global $db_host, $db_user, $db_password, $db_name;
  static $db;
  if (!$db) {
    $db = mysql_connect($db_host, $db_user, $db_password) or die;
    mysql_select_db($db_name, $db);
  }

  $args = func_get_args();
  $query = (count($args) > 1) ? call_user_func_array('sprintf', $args) : $args[0];
  return mysql_query($query, $db);
}

function db_fetch_assoc($query) {
  return mysql_fetch_assoc($query);
}