Class AutoCRUD_MySQL

Description

AutoCRUD MySQL Class

This class is used by the AutoCRUD object to query MySQL

Located in /mysql.inc.php (line 18)


	
			
Variable Summary
string $database
string $password
string $server
string $user
Method Summary
integer affected_rows ()
bool close ()
mixed connect ([string $user = null], [string $password = null], [string $database = null], [string $server = 'localhost'])
AutoCRUD_Error halt (string $code, [string $msg = ''])
mixed insert_id ()
bool is_connected ()
array queries ()
mixed query (string $query_string)
mixed query_first (string $query_string)
integer query_num ()
string quote (string $str)
string quoteInto (string $stack, mixed $needle)
mixed select_db ([string $database = null])
mixed sql_query (string $query_string, [string $key = ''])
Variables
string $database (line 50)

Database Name

Can be used to set the name of the database you want to use instead of passing it as a function argument

  • access: public
string $password (line 42)

MySQL Password

Can be used to set the MySQL password instead of passing it as a function argument

  • access: public
string $server (line 58)

MySQL Host

Can be used to set the MySQL host instead of passing it as a function argument

  • access: public
bool $usepconnect = false (line 26)

Use Persistant Connections

Set to true if you want to use persistant MySQL connections, false for regular connections

  • access: public
string $user (line 34)

MySQL User

Can be used to set the MySQL user instead of passing it as a function argument

  • access: public
Methods
affected_rows (line 375)

Returns the number of rows affected by the last query

  • return: the number of rows affected
  • access: public
integer affected_rows ()
close (line 263)

Used to close the MySQL connection

  • return: true on success, false on failure
  • access: public
bool close ()
connect (line 79)

Used to setup a connection with the MySQL server

  • return: true on success, error object on failure
  • access: public
mixed connect ([string $user = null], [string $password = null], [string $database = null], [string $server = 'localhost'])
  • string $user: MySQL user
  • string $password: MySQL password
  • string $database: name of the database you want to select
  • string $server: hostname of the MySQL server (usually localhost)
halt (line 233)

Used to return an error (mainly used internally)

  • return: an error object
  • access: public
AutoCRUD_Error halt (string $code, [string $msg = ''])
  • string $code: the error code
  • string $msg: the error message
insert_id (line 253)

Used to get the record ID of the last inserted record

  • return: the record ID of the last inserted record
  • access: public
mixed insert_id ()
is_connected (line 276)

Can be used to check whether there is a connection or not

  • return: true when connected, false when not
  • access: public
bool is_connected ()
queries (line 300)

Returns an array of all the queries that have been executed

  • return: the queries
  • access: public
array queries ()
query (line 146)

Used to execute a query on the database

  • return: resource ID on success, error object on failure
  • access: public
mixed query (string $query_string)
  • string $query_string: the query you want to execute
query_first (line 211)

Used to select a single record

  • return: returns record (as an array) on success, false when there is no record, and an error object on failure
  • access: public
mixed query_first (string $query_string)
  • string $query_string: the query you want to execute
query_num (line 290)

Returns the number of queries that have been executed

  • return: number of queries that have been executed
  • access: public
integer query_num ()
quote (line 311)

Used to prevent SQL injection, will escape all the 'dangerous' characters and put quotes around it

  • return: the escaped and quoted text (safe for SQL queries)
  • access: public
string quote (string $str)
  • string $str: the text that should be escaped
quoteInto (line 331)

Used to quote multiple variables into one statement

  • return: the statement with the data in it
  • access: public
string quoteInto (string $stack, mixed $needle)
  • string $stack: the statement (use ? as placeholders for the variables)
  • mixed $needle: a single replacement variable, or an array of multiple replacements
select_db (line 125)

Used to select a database you want to use

  • return: true on success, error object on failure
  • access: public
mixed select_db ([string $database = null])
  • string $database: name of the database you want to use
sql_query (line 175)

Used to select a list of records

  • return: array of records on success, error object on failure
  • access: public
mixed sql_query (string $query_string, [string $key = ''])
  • string $query_string: the query you want to execute
  • string $key: the key under which the records should be stored (should be a field in the table you're selecting from

Documentation generated on Wed, 14 Jun 2006 14:08:43 +0200 by phpDocumentor 1.3.0RC4