source: trunk/common/db/db_smf_mysql.php @ 1184

Revision 852, 1.1 KB checked in by cdleonard@…, 4 years ago (diff)

svn:eol-style native in trunk. Also svn:executable on all scripts

  • Property svn:eol-style set to native
Line 
1<?php
2
3// Connects to the database. Call this function if you need the database.
4// It's better than connecting when the file is included. Side-effects are bad.
5function db_connect() {
6    // SMF is already connected to the database
7}
8
9// Escapes a string to be safely included in a query.
10function db_escape($str) {
11    return mysql_real_escape_string($str);
12}
13
14// Number of rows selected by the last SELECT statement
15function db_num_rows($res) {
16    return mysql_num_rows($res);
17}
18
19// Frees mysql result
20function db_free($result) {
21    log_assert(is_resource($result));
22    mysql_free_result($result);
23}
24
25// Fetches next result row
26function db_next_row($result) {
27    return mysql_fetch_assoc($result);
28}
29
30// NOTE: Already defined in SMF
31// Returns last SQL inserted id
32// function db_insert_id();
33
34// NOTE: Already defined in SMF
35// Returns number of affected rows by the last UPDATE/INSERT statement
36// function db_affected_rows();
37
38// Executes query. Outputs error messages
39// Returns native PHP mysql resource handle
40// function db_query($query, $unbuffered = false);
41
42?>
Note: See TracBrowser for help on using the repository browser.