Location: PHPKode > scripts > OoMySql > mysqldb.class.html
<html>
<head>
  <title>OoMySql Classes</title>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15">
  <link rel="stylesheet" type="text/css" href="docstyle.css">
</head>
<body text="black" link="#0000A0">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
	<tr>
		<td class="pageHeader">MySqlDB Class</td>
	</tr>
</table>
<table cellspacing="0" cellpadding="0" border="0">
	<tr>
		<td class="headerSubLink">
			<a href="#constructor">constructor</a>
		</td>
		<td class="headerSubLink">
			<a href="#public">public</a>
		</td>
		<td class="headerSubRightEnd">
			<a href="#private">_private</a>
		</td>
	</tr>
</table>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
	<tr>
		<td class="className">
			Public :: MySqlDB
		</td>
	</tr>
	<tr>
		<td class="textNorm">
			Parent Class:
			<ul>
				<li><a href="mysql.class.html">MySql Baseclass</a></li>
			</ul>
			Subclasses:
			<ul>
				<li>none yet</li>
			</ul>
			optional helper classes:
			<ul>
				<li>also none</li>
			</ul>
		</td>
	</tr>
	<tr>
		<td height="10">&nbsp;</td>
	</tr>
	<tr>
		<td class="seperatorLine"></td>
	</tr>
	<tr>
		<td height="10">&nbsp;</td>
	</tr>
	<tr>
		<td class="textNorm">
			<p>
				Class to access a database on a MySql server.
				<pre>
	// create a new sqldb object  - Database host, Database user, Database pass, use logger class
	$sqldb = new MySqlDB("dbhost","dbuser","dbpass",true);
	// select a database 
	$sqldb->selectDB("myFirstDB");
	// now turn debug messages for all queries to "myFirstDB" on
	$sqldb->setDebugMode(TRUE);
	// and select some data 
	$result = $sqldb->select("*","firstTable","col1 = 'test'");
	</pre>
			
			</p>
		</td>
	</tr>
</table>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
	<tr>
		<td height="10" width="210">&nbsp;</td>
		<td></td>
	</tr>
	<tr>
		<td class="subHeading" colspan="2">
			<a name="constructor">constructor</a>
		</td>
	</tr>
	<tr>
		<td class="variable">MySqlDB object
		</td>
		<td class="keyword" align="left">
			= MySqlDB(STRING $server, STRING $user, STRING $password, BOOL $use_log)
		</td>
	</tr>
	<tr>
		<td></td>
		<td class="textNorm" align="left">
			create a new MySqlDB object and connect to database server
		</td>
	</tr>
	<tr>
		<td height="10">&nbsp;</td>
		<td></td>
	</tr>
	<tr>
		<td class="subHeading" colspan="2">
			<a name="public">public methods</a>
		</td>
	</tr>
	<tr>
		<td class="variable"><a name="del">RESOURCE IDENTIFIER
		</td>
		<td class="keyword" align="left">
			= MySqlDB->del(STRING $table, STRING $filter);
		</td>
	</tr>
	<tr>
		<td></td>
		<td class="textNorm" align="left">
			delete from given table using the filter in the WHERE clause, i.e. MySqlDB->del("someTable","idColumn > 100");
		</td>
	</tr>
	<tr>
		<td class="variable"><a name="emptyTable">RESOURCE IDENTIFIER
		</td>
		<td class="keyword" align="left">
			= MySqlDB->emptyTable(STRING $table);
		</td>
	</tr>
	<tr>
		<td></td>
		<td class="textNorm" align="left">
			empty a complete table and reset AUTO_INCREMENT columns, i.e. MySqlDB->emptyTable("someTable");
		</td>
	</tr>
	<tr>
		<td class="variable"><a name="getName">STRING
		</td>
		<td class="keyword" align="left">
			= MySqlDB->getName();
		</td>
	</tr>
	<tr>
		<td></td>
		<td class="textNorm" align="left">
			get name of database currently connected to
		</td>
	</tr>
		<tr>
		<td class="variable"><a name="insert">RESOURCE IDENTIFIER
		</td>
		<td class="keyword" align="left">
			= MySqlDB->insert(STRING $table, STRING||ARRAY $cols, STRING $vals);
		</td>
	</tr>
	<tr>
		<td></td>
		<td class="textNorm" align="left">
			insert data into the specified table, i.e. MySqlDB->insert("someTable","col1, col2", "val1, 'val2'");
			This method can also receive an associative array [with column_name as key and column_value as value] as second argument.
		</td>
	</tr>
	<tr>
		<td class="variable"><a name="listTables">RESOURCE IDENTIFIER
		</td>
		<td class="keyword" align="left">
			= MySqlDB->listTables();
		</td>
	</tr>
	<tr>
		<td></td>
		<td class="textNorm" align="left">
			get a list of all tables accessible by the current user in the current database
		</td>
	</tr>
	<tr>
		<td class="variable"><a name="select">RESOURCE IDENTIFIER
		</td>
		<td class="keyword" align="left">
			= MySqlDB->select(STRING $what, STRING $table, STRING $filter, STRING $order);
		</td>
	</tr>
	<tr>
		<td></td>
		<td class="textNorm" align="left">
			select data from table(s), i.e. MySqlDB->select("*","someTable as sT, anotherTable as aT","someColumn LIKE '%test%'","someColumn");
		</td>
	</tr>
	<tr>
		<td class="variable"><a name="MySqlTable">MySqlTable Object Reference</td>
		<td class="keyword" align="left">
			= MySqlDB->selectTable(STRING $table);
		</td>
	</tr>
	<tr>
		<td></td>
		<td class="textNorm" align="left">
			select the specified table and receive a corresponding MySqlTable object
		</td>
	</tr>
	<tr>
		<td class="variable"><a name="update">RESOURCE IDENTIFIER</td>
		<td class="keyword" align="left">
			= MySqlDB->update(STRING $table, STRING||ARRAY $cols_vals, STRING $filter);
		</td>
	</tr>
	<tr>
		<td></td>
		<td class="textNorm" align="left">
			update data in the specified table, i.e. MySqlDB->update("someTable","someColumn = 'someValue', anotherColumn = 10","someColumn = 'update'");<br>
			Like the insert method, this method can receive an associative array [with column_name as key and column_value as value] as second argument.
		</td>
	</tr>
	<tr>
		<td height="10" width="210">&nbsp;</td>
		<td></td>
	</tr>
	<tr>
		<td class="subHeading" colspan="2">
			<a name="constructor">inherited methods</a>
		</td>
	</tr>
		<tr>
		<td class="variable"></td>
		<td class="textNorm" align="left">
			see <a href="mysql.class.html"> MySql Baseclass</a>	
		</td>
	</tr>
	<tr>
		<td class="pageFooter" colspan="2">&nbsp;</td>
	</tr>
</table>
</body>
</html>
Return current item: OoMySql