phpgamedev-cvs-commits Mailing List for PHPGameDev
Status: Planning
Brought to you by:
sphen001
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(44) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: Nick <sph...@us...> - 2005-06-14 20:30:58
|
Update of /cvsroot/phpgamedev/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26212 Removed Files: readme.html readme.txt Log Message: --- readme.html DELETED --- --- readme.txt DELETED --- |
From: Nick <sph...@us...> - 2005-06-14 20:29:24
|
Update of /cvsroot/phpgamedev/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25233 Added Files: db_readme.txt Log Message: --- NEW FILE: db_readme.txt --- /**************************************************/ /* /* Readme for PHPGameDev DB Abstraction Layer /* $Id: db_readme.txt,v 1.1 2005/06/14 20:29:16 sphen001 Exp $ /**************************************************/ You can find an online version of this readme at: http://phpgamedev.sourceforge.net/docs/db_readme.html Feature List: Features of the PHPGameDev DB Abstraction Layer DB Layer Definition: All of the DB layers support a type definition. You can use this definition to switch between code for different DBMS's. For example, if you had a query that would not run in Oracle, you could use a switch to switch what code you use. <?php // We have a query that will run on every DBMS except Oracle switch ( DB ) { case 'MySQL' : case 'MSSQL' : $sql = 'Regular SQL code here'; break; case 'Oracle' : $sql = 'Oracle specific SQL code here'; break; { ?> Connection Type: Supports both normal and persistent connections. Function Reference: Here we'll define all the functions and explain what they are used for. Function: connect($db_host, $db_username, $db_password, $db, $persistent = FALSE) This function connects to a DB. Only $persistent is not required. $db_host: The hostname of the DB server you are connecting to. $db_username: The DB username you will be using. $db_password: The DB password you will be using. $db: The specific DB you will be accessing. $persistent: Open a persistent connection or not. Defaults to no. Returns TRUE on success, and FALSE on failure. Example: <?php $db->connect('localhost', 'root', '', 'some_db', FALSE); ?> Function: disconnect() This function disconnects from a DB. You do not specify any arguments. Returns TRUE on success, and FALSE on failure. Example: <?php $db->disconnect(); ?> Function: query($query) This function executes a query on the DB. All arguments are required. $query: The SQL query that is to be executed. Returns the result on success, and FALSE on failure. Example: <?php $sql = "SELECT * FROM some_db WHERE some_condition='some_condition'"; $db->query($sql); ?> Function: fetch_row($result, $type = 'ASSOC') This function fetches a row from the DB. Only $result is required. $result: The result of an executed SQL query. $type: The type of fetch_row you want to perform. Defaults to ASSOC. Types: ASSOC: Fetches an associative array (mysql_fetch_assoc()) ARRAY: Fetches an array (mysql_fetch_array()) OBJECT: Fetches an object (mysql_fetch_object()) ROW: Fetches a single row (mysql_fetch_row()) Returns row on success, and FALSE on failure. Example: <?php while ( $row = $db->fetch_row($result, 'ASSOC') ) { echo $row['field_name']; } while ( $row = $db->fetch_row($result, 'ARRAY') ) { echo $row[0]; } while ( $row = $db->fetch_row($result, 'OBJECT') ) { echo $row->some_field; } while ( $row = $db->fetch_row($result, 'ROW') ) { echo $row[0]; { ?> Function: num_rows($result) This function fetches the number of rows affected by the executed SQL query. All arguments are required. $result: The result of an executed SQL query. Returns number of rows on success, and FALSE on failure. Example: <?php echo $db->num_rows($result); ?> Function: free_result($result) This function frees up the memory associated with the executed SQL query. All arguments are required. $result: The result of an executed SQL query. Returns TRUE always. Example: <?php $db->free_result($result); ?> Function: num_queries() This function returns the number of queries that were performed during the scripts execution. Returns the number of queries performed. Example: <?php echo $db->num_queries(); ?> Function: escape($sql) This function escapes a SQL query. Returns the escaped query Example: <?php $sql = "SELECT * FROM some_table"; $sql = $db->escape($sql); ?> Variable Reference: Here are explanations of the variables used in the DB layer. var $connect_id: Contains the connection details of the DB connection. var $query_result: Contains the result of the executed SQL query. var $query_rowset: Contains a row selected from the result of the executed SQL query. var $num_rows: Contains the number of affected rows. var $num_queries: Contains the number of queries performed in the scripts execution. Example Script: An example script to demonstrate the features of this layer. <?php // Include the DB layer, and instantiate a new class include './db_*.php'; $db = new db; // Connect $db->connect('localhost', 'root', '', 'db', FALSE); // Perform a query switch ( DB ) { case 'MySQL' : case 'MSSQL' : $sql = "SELECT * FROM some_table"; break; case 'Oracle' : $sql = "Oracle specific code"; break; } $sql = $db->escape($sql); $result = $db->query($sql); // Get the result set while ( $row = $db->fetch_row($result, 'ASSOC') ) { echo $row['field_name']; } // Get then number of affected rows and number of queries echo $db->num_rows($result); echo $db->num_queries(); // Disconnect $db->disconnect(); ?> |
From: Nick <sph...@us...> - 2005-06-14 20:24:21
|
Update of /cvsroot/phpgamedev/website/styles In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23297/styles Modified Files: style.css Log Message: Index: style.css =================================================================== RCS file: /cvsroot/phpgamedev/website/styles/style.css,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** style.css 14 Jun 2005 20:19:52 -0000 1.1 --- style.css 14 Jun 2005 20:24:05 -0000 1.2 *************** *** 3,6 **** --- 3,7 ---- Written by Sphen (Nick Ross) Derived from phpBB subSilver 2 + $Id$ */ |
From: Nick <sph...@us...> - 2005-06-14 20:21:08
|
Update of /cvsroot/phpgamedev/website/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21552/docs Added Files: db_readme.php Log Message: --- NEW FILE: db_readme.php --- <?php //----------------------------------------------------------- // FILENAME : index.php // STARTED : Mon Jun 13, 2005 // AUTHOR : Sphen001 (Nick Ross) // SUPPORT : http://phpgamedev.sourceforge.net // COPYRIGHT : Copyright 2005 © PHPGameDev Group // E-MAIL : Sphen001 -at- users -dot- sourceforge -dot- net // $Id: db_readme.php,v 1.1 2005/06/14 20:20:57 sphen001 Exp $ //----------------------------------------------------------- echo (' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title> PHPGameDev DB Abstraction Layer </title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <link rel="stylesheet" href="../styles/style.css" type="text/css" /> </head> <body> <!-- Begin header --> <p class="titles" align="center"> PHPGameDev DB Abstraction Layer Readme </p> <br /> <!-- Begin body --> <!-- Begin features --> <table class="tablebg" width="90%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th colspan="2"> Feature List </th> </tr> <tr> <td class="nav" colspan="2" align="center"> Features of the PHPGameDev DB Abstraction Layer </td> </tr> <tr> <td class="row1" width="25%"> <b> DB Layer Definition: </b> </td> <td class="row2"> All of the DB layers support a type definition. You can use this definition to switch between code for different DBMS\'s. <br /> <br /> For example, if you had a query that would not run in Oracle, you could use a switch to switch what code you use. <br /> <br /> <pre> <span class="php_comment">// We have a query that will run on every DBMS except Oracle</span> <span class="php_keyword">switch</span> ( <span class="php_default">DB</span> ) { <span class="php_keyword">case</span> <span class="php_string">\'MySQL\'</span> : <span class="php_keyword">case</span> <span class="php_string">\'MSSQL\'</span> : <span class="php_default">$sql</span> = <span class="php_string">\'Regular SQL code here\'</span>; <span class="php_keyword">break</span>; <span class="php_keyword">case</span> <span class="php_string">\'Oracle\'</span> : <span class="php_default">$sql</span> = <span class="php_string">\'Oracle specific SQL code here\'</span>; <span class="php_keyword">break</span>; } </pre> </td> </tr> <tr> <td class="row1" width="25%"> <b> Connection Type: </b> </td> <td class="row2"> Supports both normal and persistent connections. </td> </tr> </table> <!-- End features --> <br /> <!-- Begin functions --> <table class="tablebg" width="10%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th colspan="2"> Function Reference </th> </tr> <tr> <td class="nav" colspan="2" align="center"> Here we\'ll define all the functions and explain what they are used for. </td> </tr> <tr> <td class="row1" width="25%"> <b> Function:<br />connect($db_host, $db_username, $db_password, $db, $persistent = FALSE) </b> </td> <td class="row2"> This function connects to a DB. Only <b>$persistent</b> is not required. <br /> <br /> <b>$db_host:</b> The hostname of the DB server you are connecting to. <br /> <b>$db_username:</b> The DB username you will be using. <br /> <b>$db_password:</b> The DB password you will be using. <br /> <b>$db:</b> The specific DB you will be accessing. <br /> <b>$persistent:</b> Open a persistent connection or not. Defaults to no. <br /><br /> Returns TRUE on success, and FALSE on failure. <br /> <br /> <b> Example: </b> <br /> <pre> <span class="php_default">$db</span>-><span class="php_default">connect</span>(<span class="php_string">\'localhost\', \'root\', \'\', \'some_db\', FALSE)</span>; </pre> </td> </tr> <tr> <td class="row1" width="25%"> <b> Function:<br />disconnect() </b> </td> <td class="row2"> This function disconnects from a DB. You do not specify any arguments. <br /> <br /> Returns TRUE on success, and FALSE on failure. <br /> <br /> <b> Example: </b> <br /> <pre> <span class="php_default">$db</span>-><span class="php_default">disconnect</span>(); </pre> </td> </tr> <tr> <td class="row1" width="25%"> <b> Function:<br />query($query) </b> </td> <td class="row2"> This function executes a query on the DB. All arguments are required. <br /> <br /> <b>$query:</b> The SQL query that is to be executed. <br /> <br /> Returns the result on success, and FALSE on failure. <br /> <br /> <b> Example: </b> <br /> <pre> <span class="php_default">$sql</span> = <span class="php_string">"SELECT *</span> <span class="php_string">FROM some_db</span> <span class="php_string">WHERE some_condition=\'some_condition\'"</span>; <span class="php_default">$db</span>-><span class="php_default">query($sql)</span>; </pre> </td> </tr> <tr> <td class="row1" width="25%"> <b> Function:<br />fetch_row($result, $type = \'ASSOC\') </b> </td> <td class="row2"> This function fetches a row from the DB. Only $result is required. <br /> <br /> <b>$result:</b> The result of an executed SQL query. <br /> <b>$type:</b> The type of fetch_row you want to perform. Defaults to ASSOC. <br /> <br /> <b> Types: </b> <br /> <br /> <b>ASSOC:</b> Fetches an associative array (mysql_fetch_assoc()) <br /> <b>ARRAY:</b> Fetches an array (mysql_fetch_array()) <br /> <b>OBJECT:</b> Fetches an object (mysql_fetch_object()) <br /> <b>ROW:</b> Fetches a single row (mysql_fetch_row()) <br /> <br /> Returns row on success, and FALSE on failure. <br /> <br /> <b> Example: </b> <br /> <pre> <span class="php_keyword">while</span> ( <span class="php_default">$row</span> = <span class="php_default">$db</span>-><span class="php_default">fetch_row</span>(<span class="php_default">$result</span>, <span class="php_string">\'ASSOC\'</span>) ) { <span class="php_keyword">echo</span> <span class="php_default">$row</span>[<span class="php_string">\'field_name\'</span>]; } <span class="php_keyword">while</span> ( <span class="php_default">$row</span> = <span class="php_default">$db</span>-><span class="php_default">fetch_row</span>(<span class="php_default">$result</span>, <span class="php_string">\'ARRAY\'</span>) ) { <span class="php_keyword">echo</span> <span class="php_default">$row</span>[0]; } <span class="php_keyword">while</span> ( <span class="php_default">$row</span> = <span class="php_default">$db</span>-><span class="php_default">fetch_row</span>(<span class="php_default">$result</span>, <span class="php_string">\'OBJECT\'</span>) ) { <span class="php_keyword">echo</span> <span class="php_default">$row</span>-><span class="php_default">some_field</span>; } <span class="php_keyword">while</span> ( <span class="php_default">$row</span> = <span class="php_default">$db</span>-><span class="php_default">fetch_row</span>(<span class="php_default">$result</span>, <span class="php_string">\'ROW\'</span>) ) { <span class="php_keyword">echo</span> <span class="php_default">$row</span>[0]; } </pre> </td> </tr> <tr> <td class="row1" width="25%"> <b> Function:<br />num_rows($result) </b> </td> <td class="row2"> This function fetches the number of rows affected by the executed SQL query. All arguments are required. <br /> <br /> <b>$result:</b> The result of an executed SQL query. <br /> <br /> Returns number of rows on success, and FALSE on failure. <br /> <br /> <b> Example: </b> <br /> <pre> <span class="php_keyword">echo</span> <span class="php_default">$db</span>-><span class="php_default">num_rows</span>(<span class="php_default">$result</span>); </pre> </td> </tr> <tr> <td class="row1" width="25%"> <b> Function:<br />free_result($result) </b> </td> <td class="row2"> This function frees up the memory associated with the executed SQL query. All arguments are required. <br /> <br /> <b>$result:</b> The result of an executed SQL query. <br /> <br /> Returns TRUE always. <br /> <br /> <b> Example: </b> <br /> <pre> <span class="php_default">$db</span>-><span class="php_default">free_result</span>(<span class="php_default">$result</span>); </pre> </td> </tr> <tr> <td class="row1" width="25%"> <b> Function:<br />num_queries() </b> </td> <td class="row2"> This function returns the number of queries that were performed during the scripts execution. <br /> <br /> Returns the number of queries performed. <br /> <br /> <b> Example: </b> <br /> <pre> <span class="php_keyword">echo</span> <span class="php_default">$db</span>-><span class="php_default">num_queries</span>(); </pre> </td> </tr> <tr> <td class="row1" width="25%"> <b> Function:<br />escape($sql) </b> </td> <td class="row2"> This function escapes a SQL query. <br /> <br /> Returns the escaped query <br /> <br /> <b> Example: </b> <br /> <pre> <span class="php_default">$sql</span> = <span class="php_string">"SELECT *</span> <span class="php_string">FROM some_table"</span>; <span class="php_default">$sql</span> = <span class="php_default">$db</span>-><span class="php_default">escape</span>(<span class="php_default">$sql</span>); </pre> </td> </tr> </table> <!-- End functions --> <br /> <!-- Begin variables --> <table class="tablebg" width="90%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th colspan="2"> Variable Reference </th> </tr> <tr> <td class="nav" colspan="2" align="center"> Here are explanations of the variables used in the DB layer. </td> </tr> <tr> <td class="row1" width="25%"> <b> var $connect_id: </b> </td> <td class="row2"> Contains the connection details of the DB connection. </td> </tr> <tr> <td class="row1" width="25%"> <b> var $query_result: </b> </td> <td class="row2"> Contains the result of the executed SQL query. </td> </tr> <tr> <td class="row1" width="25%"> <b> var $query_rowset: </b> </td> <td class="row2"> Contains a row selected from the result of the executed SQL query. </td> </tr> <tr> <td class="row1" width="25%"> <b> var $num_rows: </b> </td> <td class="row2"> Contains the number of affected rows. </td> </tr> <tr> <td class="row1" width="25%"> <b> var $num_queries: </b> </td> <td class="row2"> Contains the number of queries performed in the scripts execution. </td> </tr> </table> <!-- End variables --> <br /> <!-- Begin example --> <table class="tablebg" width="90%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th> Example Script </th> </tr> <tr> <td class="nav" colspan="2" align="center"> An example script to demonstrate the features of this layer </td> </tr> <tr> <td class="row1"> <pre> <span class="php_comment">// Include the DB layer, and instantiate a new class</span> <span class="php_keyword">include</span> <span class="php_string">\'./db_*.php\'</span>; <span class="php_default">$db</span> = <span class="php_keyword">new</span> <span class="php_default">db</span>; <span class="php_comment">// Connect</span> <span class="php_default">$db</span>-><span class="php_default">connect</span>(<span class="php_string">\'localhost\'</span>, <span class="php_string">\'root\'</span>, <span class="php_string">\'\'</span>, <span class="php_string">\'db\'</span>, <span class="php_keyword">FALSE</span>); <span class="php_comment">// Perform a query</span> <span class="php_keyword">switch</span> ( <span class="php_default">DB</span> ) { <span class="php_keyword">case</span> <span class="php_string">\'MySQL\'</span> : <span class="php_keyword">case</span> <span class="php_string">\'MSSQL\'</span> : <span class="php_default">$sql</span> = <span class="php_string">"SELECT *</span> <span class="php_string">FROM some_table"</span>; <span class="php_keyword">break</span>; <span class="php_keyword">case</span> <span class="php_string">\'Oracle\'</span> : <span class="php_default">$sql</span> = <span class="php_string">"Oracle specific code"</span>; <span class="php_keyword">break</span>; } <span class="php_default">$result</span> = <span class="php_default">$db</span>-><span class="php_default">query($sql)</span>; <span class="php_comment">// Get the result set</span> <span class="php_keyword">while</span> ( <span class="php_default">$row</span> = <span class="php_default">$db</span>-><span class="php_default">fetch_row($result</span>, <span class="php_string">\'ASSOC\'</span>) ) { <span class="php_keyword">echo</span> <span class="php_default">$row</span>[<span class="php_string">\'field_name\'</span>]; } <span class="php_comment">// Get then number of affected rows and number of queries</span> <span class="php_keyword">echo</span> <span class="php_default">$db</span>-><span class="php_default">num_rows($result)</span>; <span class="php_keyword">echo</span> <span class="php_default">$db</span>-><span class="php_default">num_queries()</span>; <span class="php_comment">// Disconnect</span> <span class="php_default">$db</span>-><span class="php_default">disconnect()</span>; </pre> </td> </tr> </table> <!-- End example --> <br /> <!-- Begin footer --> <center> <a href="../index.php">Back to Index</a> </center> <br /> <center> <a href="http://validator.w3.org/check?uri=http%3A%2F%2Fphpgamedev.sourceforge.net%2Fdocs%2Fdb_readme.php"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a> </center> <br /> <center> <a href="http://sourceforge.net/projects/phpgamedev/"><img src="http://sourceforge.net/sflogo.php?group_id=140827&type=5" width="210" height="62" border="0" alt="SourceForge.net Logo" /></a> </center> <br /> <p class="copyright" align="center"> All information on this website is Copyright © PHPGameDev Group 2005 </p> <!-- End footer --> </body> </html> '); ?> |
From: Nick <sph...@us...> - 2005-06-14 20:20:31
|
Update of /cvsroot/phpgamedev/website/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21146/docs Log Message: Directory /cvsroot/phpgamedev/website/docs added to the repository |
From: Nick <sph...@us...> - 2005-06-14 20:20:02
|
Update of /cvsroot/phpgamedev/website/styles In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20668/styles Added Files: style.css Log Message: --- NEW FILE: style.css --- /* PHPGameDev Website StyleSheet Written by Sphen (Nick Ross) Derived from phpBB subSilver 2 */ /* BODY */ body { scrollbar-face-color: #DEE3E7; scrollbar-highlight-color: #FFFFFF; scrollbar-shadow-color: #DEE3E7; scrollbar-3dlight-color: #D1D7DC; scrollbar-arrow-color: #006699; scrollbar-track-color: #EFEFEF; scrollbar-darkshadow-color: #98AAB1; margin: 0px; border: 0px; padding: 0px; background-color: white; font-family: Verdana, Helvetica, sans-serif; } .nav { margin: 0px; color: black; font-size: 70%; font-weight: bold; } .titles { color: black; font-family: Arial, Helvetica, sans-serif; font-weight: bold; font-size: 130%; text-decoration: none; } /* TABLE */ th { height: 28px; color: #FFA34F; font-size: 70%; font-weight: bold; background-color: #006699; background-image: url('./images/cellpic3.gif'); white-space: nowrap; padding-left: 5px; padding-right: 5px; } .tablebg { background-color: #A9B8C2; } .row1 { background-color: #ECECEC; padding: 4px; } .row2 { background-color: #DCE1E5; padding: 4px; } /* LINKS */ a:link { color: #005784; text-decoration: none; } a:visited { color: #005784; text-decoration: none; } a:hover { color: #D46400; text-decoration: underline; } /* PHP */ .php_comment { color: #FF8000; } .php_default { color: #0000BB; } .php_keyword { color: #007700; } .php_string { color: #DD0000; } /* TEXT */ .green { color: #00FF00; } .red { color: #FF0000; } .copyright { height: 28px; font-size: 60%; } |
From: Nick <sph...@us...> - 2005-06-14 20:19:39
|
Update of /cvsroot/phpgamedev/website/styles In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20456/styles Log Message: Directory /cvsroot/phpgamedev/website/styles added to the repository |
From: Nick <sph...@us...> - 2005-06-14 20:19:20
|
Update of /cvsroot/phpgamedev/website/links In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20336/links Log Message: Directory /cvsroot/phpgamedev/website/links added to the repository |
From: Nick <sph...@us...> - 2005-06-14 20:19:00
|
Update of /cvsroot/phpgamedev/website/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20240/includes Log Message: Directory /cvsroot/phpgamedev/website/includes added to the repository |
From: Nick <sph...@us...> - 2005-06-14 20:18:41
|
Update of /cvsroot/phpgamedev/website/contact In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20141/contact Log Message: Directory /cvsroot/phpgamedev/website/contact added to the repository |
From: Nick <sph...@us...> - 2005-06-14 20:14:04
|
Update of /cvsroot/phpgamedev/website In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18377 Removed Files: db_readme.html style.css Log Message: --- db_readme.html DELETED --- --- style.css DELETED --- |
From: Nick <sph...@us...> - 2005-06-14 20:13:26
|
Update of /cvsroot/phpgamedev/website In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18018 Added Files: index.php Log Message: New index page. --- NEW FILE: index.php --- <?php //----------------------------------------------------------- // FILENAME : index.php // STARTED : Mon Jun 13, 2005 // AUTHOR : Sphen001 (Nick Ross) // SUPPORT : http://phpgamedev.sourceforge.net // COPYRIGHT : Copyright 2005 © PHPGameDev Group // E-MAIL : Sphen001 -at- users -dot- sourceforge -dot- net // $Id: index.php,v 1.1 2005/06/14 20:13:17 sphen001 Exp $ //----------------------------------------------------------- echo (' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title> PHPGameDev Website </title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <link rel="stylesheet" href="./styles/style.css" type="text/css" /> </head> <body> <!-- Begin header --> <p class="titles" align="center"> Welcome to the PHPGameDev website </p> <!-- End header --> <br /> <!-- Begin main --> <table class="tablebg" width="90%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th> Welcome! </th> </tr> <tr> <td class="row1"> Thank you for visiting the PHPGameDev website. This is a project designed to help game designers simplify their tasks. We hope to provide several plugins that will help game designers to do their work faster. You can visit our Sourceforge.net Project page <a href="http://www.sourceforge.net/projects/phpgamedev">here</a> </td> </tr> </table> <br /> <table class="tablebg" width="90%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th colspan="2"> Planned Features </th> </tr> <tr> <td class="nav" colspan="2" align="center"> We have several scripts that we are planning to create, but we need your suggestions. The scripts we have planned so far are: </td> </tr> <tr> <td class="row2" width="50%" align="center"> Feature </td> <td class="row2" align="center"> Status </td> </tr> <tr> <td class="row1" width="50%"> <center> <a href="./docs/db_readme.php">Game optimized DB Abstraction Layer</a> </center> </td> <td class="row1"> <center> <span class="green"> Completed </span> </center> </td> </tr> <tr> <td class="row1" width="50%"> <center> Game optimized Templating System </center> </td> <td class="row1"> <center> <span class="red"> Not Completed </span> </center> </td> </tr> </table> <!-- End main --> <br /> <!-- Begin footer --> <center> [ <a href="./index.php">Index</a> - <a href="./board/">Forums</a> - <a href="./contact/">Contact</a> - <a href="./links/">Links</a> ] </center> <br /> <center> <a href="http://validator.w3.org/check?uri=http%3A%2F%2Fphpgamedev.sourceforge.net%2Findex.php"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a> </center> <br /> <center> <a href="http://sourceforge.net/projects/phpgamedev/"><img src="http://sourceforge.net/sflogo.php?group_id=140827&type=5" width="210" height="62" border="0" alt="SourceForge.net Logo" /></a> </center> <br /> <p class="copyright" align="center"> All information on this website is Copyright © PHPGameDev Group 2005 </p> <!-- End footer --> </body> </html> ') ?> |
From: Nick <sph...@us...> - 2005-06-14 20:12:28
|
Update of /cvsroot/phpgamedev/website In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17388 Removed Files: index.html Log Message: --- index.html DELETED --- |
From: Nick <sph...@us...> - 2005-06-09 03:05:11
|
Update of /cvsroot/phpgamedev/website In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7121 Modified Files: index.html Log Message: Index: index.html =================================================================== RCS file: /cvsroot/phpgamedev/website/index.html,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** index.html 9 Jun 2005 01:54:26 -0000 1.7 --- index.html 9 Jun 2005 02:05:56 -0000 1.8 *************** *** 23,27 **** <ul> ! <li>Game optimized templating system (View readme file <a href="http://phpgamedev.sourceforge.net/docs/db_readme.html">here</a></li> <li>Game optimized db abstraction layer</li> </ul> --- 23,27 ---- <ul> ! <li>Game optimized templating system (View readme file <a href="http://phpgamedev.sourceforge.net/docs/db_readme.html">here</a>)</li> <li>Game optimized db abstraction layer</li> </ul> |
From: Nick <sph...@us...> - 2005-06-09 02:46:16
|
Update of /cvsroot/phpgamedev/website In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28317 Modified Files: db_readme.html Log Message: X/HTML Validation. Index: db_readme.html =================================================================== RCS file: /cvsroot/phpgamedev/website/db_readme.html,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** db_readme.html 9 Jun 2005 02:33:57 -0000 1.6 --- db_readme.html 9 Jun 2005 02:46:03 -0000 1.7 *************** *** 9,18 **** <body> <p class="titles" align="center">PHPGameDev DB Abstraction Layer Readme</p> <center><a href="http://phpgamedev.sourceforge.net/index.html">Back to Index</a></center> ! <br /> <table class="tablebg" width="100%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> --- 9,22 ---- <body> + <!-- Begin header --> <p class="titles" align="center">PHPGameDev DB Abstraction Layer Readme</p> <center><a href="http://phpgamedev.sourceforge.net/index.html">Back to Index</a></center> ! <!-- End header --> ! <br /> + <!-- Begin body --> + <!-- Begin features --> <table class="tablebg" width="100%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> *************** *** 64,70 **** </tr> </table> ! <br /> <table class="tablebg" width="100%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> --- 68,76 ---- </tr> </table> ! <!-- End features --> ! <br /> + <!-- Begin functions --> <table class="tablebg" width="100%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> *************** *** 338,344 **** </tr> </table> ! <br /> <table class="tablebg" width="100%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> --- 344,352 ---- </tr> </table> ! <!-- End functions --> ! <br /> + <!-- Begin variables --> <table class="tablebg" width="100%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> *************** *** 379,383 **** <td class="row1" width="25%"> <b>var $num_rows:</b> ! <td class="row2"> Contains the number of affected rows. </td> --- 387,392 ---- <td class="row1" width="25%"> <b>var $num_rows:</b> ! </td> ! <td class="row2"> Contains the number of affected rows. </td> *************** *** 392,398 **** --- 401,409 ---- </tr> </table> + <!-- End variables --> <br /> + <!-- Begin example --> <table class="tablebg" width="100%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> *************** *** 452,461 **** --- 463,482 ---- </tr> </table> + <!-- End example --> <br /> + <!-- Begin footer --> <center><a href="http://phpgamedev.sourceforge.net/index.html">Back to Index</a></center> <br /> + <center><a href="http://validator.w3.org/check?uri=http%3A%2F%2Fphpgamedev.sourceforge.net%2Findex.html"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></center> + + <br /> + <center><img src="http://sourceforge.net/sflogo.php?group_id=140827&type=5" width="210" height="62" border="0" alt="SourceForge.net Logo" /></center> + <!-- End footer --> + + </body> + </html> \ No newline at end of file |
From: Nick <sph...@us...> - 2005-06-09 02:34:06
|
Update of /cvsroot/phpgamedev/website In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22087 Modified Files: db_readme.html Log Message: Index: db_readme.html =================================================================== RCS file: /cvsroot/phpgamedev/website/db_readme.html,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** db_readme.html 9 Jun 2005 02:30:16 -0000 1.5 --- db_readme.html 9 Jun 2005 02:33:57 -0000 1.6 *************** *** 4,7 **** --- 4,8 ---- <head> <title>PHPGameDev DB Abstraction Layer</title> + <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <link rel="stylesheet" href="../styles/style.css" type="text/css" /> </head> |
From: Nick <sph...@us...> - 2005-06-09 02:30:26
|
Update of /cvsroot/phpgamedev/website In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20226 Modified Files: db_readme.html Log Message: Index: db_readme.html =================================================================== RCS file: /cvsroot/phpgamedev/website/db_readme.html,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** db_readme.html 9 Jun 2005 02:08:24 -0000 1.4 --- db_readme.html 9 Jun 2005 02:30:16 -0000 1.5 *************** *** 1,3 **** --- 1,4 ---- <!-- $Id$ --> + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> |
From: Nick <sph...@us...> - 2005-06-09 02:14:54
|
Update of /cvsroot/phpgamedev/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11611 Modified Files: readme.html Log Message: Index: readme.html =================================================================== RCS file: /cvsroot/phpgamedev/plugins/readme.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** readme.html 9 Jun 2005 01:39:24 -0000 1.1 --- readme.html 9 Jun 2005 02:14:43 -0000 1.2 *************** *** 3,7 **** <head> <title>PHPGameDev DB Abstraction Layer</title> ! <link rel="stylesheet" href="style.css" type="text/css" /> </head> <body> --- 3,7 ---- <head> <title>PHPGameDev DB Abstraction Layer</title> ! <link rel="stylesheet" href="./style.css" type="text/css" /> </head> <body> *************** *** 13,17 **** <br /> ! <table class="tablebg" width="90%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th colspan="2"> --- 13,17 ---- <br /> ! <table class="tablebg" width="100%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th colspan="2"> *************** *** 65,69 **** <br /> ! <table class="tablebg" width="90%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th colspan="2"> --- 65,69 ---- <br /> ! <table class="tablebg" width="100%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th colspan="2"> *************** *** 339,343 **** <br /> ! <table class="tablebg" width="90%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th colspan="2"> --- 339,343 ---- <br /> ! <table class="tablebg" width="100%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th colspan="2"> *************** *** 393,397 **** <br /> ! <table class="tablebg" width="90%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th>Example Script</th> --- 393,397 ---- <br /> ! <table class="tablebg" width="100%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th>Example Script</th> *************** *** 454,455 **** --- 454,459 ---- <center><a href="http://phpgamedev.sourceforge.net/index.html">Back to Index</a></center> + + <br /> + + <center><img src="http://sourceforge.net/sflogo.php?group_id=140827&type=5" width="210" height="62" border="0" alt="SourceForge.net Logo" /></center> |
From: Nick <sph...@us...> - 2005-06-09 02:08:33
|
Update of /cvsroot/phpgamedev/website In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8228 Modified Files: db_readme.html Log Message: Index: db_readme.html =================================================================== RCS file: /cvsroot/phpgamedev/website/db_readme.html,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** db_readme.html 9 Jun 2005 02:03:42 -0000 1.3 --- db_readme.html 9 Jun 2005 02:08:24 -0000 1.4 *************** *** 454,455 **** --- 454,459 ---- <center><a href="http://phpgamedev.sourceforge.net/index.html">Back to Index</a></center> + + <br /> + + <center><img src="http://sourceforge.net/sflogo.php?group_id=140827&type=5" width="210" height="62" border="0" alt="SourceForge.net Logo" /></center> |
From: Nick <sph...@us...> - 2005-06-09 02:03:50
|
Update of /cvsroot/phpgamedev/website In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6181 Modified Files: db_readme.html Log Message: Index: db_readme.html =================================================================== RCS file: /cvsroot/phpgamedev/website/db_readme.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** db_readme.html 9 Jun 2005 01:52:54 -0000 1.2 --- db_readme.html 9 Jun 2005 02:03:42 -0000 1.3 *************** *** 13,17 **** <br /> ! <table class="tablebg" width="90%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th colspan="2"> --- 13,17 ---- <br /> ! <table class="tablebg" width="100%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th colspan="2"> *************** *** 65,69 **** <br /> ! <table class="tablebg" width="90%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th colspan="2"> --- 65,69 ---- <br /> ! <table class="tablebg" width="100%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th colspan="2"> *************** *** 339,343 **** <br /> ! <table class="tablebg" width="90%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th colspan="2"> --- 339,343 ---- <br /> ! <table class="tablebg" width="100%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th colspan="2"> *************** *** 393,397 **** <br /> ! <table class="tablebg" width="90%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th>Example Script</th> --- 393,397 ---- <br /> ! <table class="tablebg" width="100%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th>Example Script</th> |
From: Nick <sph...@us...> - 2005-06-09 01:54:35
|
Update of /cvsroot/phpgamedev/website In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1102 Modified Files: index.html Log Message: Added new link. Index: index.html =================================================================== RCS file: /cvsroot/phpgamedev/website/index.html,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** index.html 8 Jun 2005 02:58:59 -0000 1.6 --- index.html 9 Jun 2005 01:54:26 -0000 1.7 *************** *** 23,27 **** <ul> ! <li>Game optimized templating system</li> <li>Game optimized db abstraction layer</li> </ul> --- 23,27 ---- <ul> ! <li>Game optimized templating system (View readme file <a href="http://phpgamedev.sourceforge.net/docs/db_readme.html">here</a></li> <li>Game optimized db abstraction layer</li> </ul> |
From: Nick <sph...@us...> - 2005-06-09 01:53:23
|
Update of /cvsroot/phpgamedev/website In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32607 Modified Files: db_readme.html Log Message: Path changes Index: db_readme.html =================================================================== RCS file: /cvsroot/phpgamedev/website/db_readme.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** db_readme.html 9 Jun 2005 01:27:37 -0000 1.1 --- db_readme.html 9 Jun 2005 01:52:54 -0000 1.2 *************** *** 3,7 **** <head> <title>PHPGameDev DB Abstraction Layer</title> ! <link rel="stylesheet" href="style.css" type="text/css" /> </head> <body> --- 3,7 ---- <head> <title>PHPGameDev DB Abstraction Layer</title> ! <link rel="stylesheet" href="../styles/style.css" type="text/css" /> </head> <body> |
From: Nick <sph...@us...> - 2005-06-09 01:41:39
|
Update of /cvsroot/phpgamedev/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26398 Added Files: db_mysql.php Log Message: Initial commit of db_mysql file. --- NEW FILE: db_mysql.php --- <?php //----------------------------------------------------------- // FILENAME : db_mysql.php // STARTED : Tue Jun 7, 2005 // AUTHOR : Sphen001 (Nick Ross) // SUPPORT : http://phpgamedev.sourceforge.net // COPYRIGHT : Copyright 2005 © PHPGameDev Group // E-MAIL : Sphen001 -at- users -dot- sourceforge -dot- net // $Id: db_mysql.php,v 1.6 2005/06/09 01:41:31 sphen001 Exp $ //----------------------------------------------------------- if ( !defined( 'DB' ) ) { define( 'DB', 'MySQL' ); } class db { var $connect_id; var $query_result; var $query_rowset; var $num_rows; var $num_queries = 0; function connect($db_host, $db_username, $db_password, $db, $persistent = FALSE) { if ( $this->connect_id = ( $persistent ) ? @mysql_pconnect($db_host, $db_username, $db_password) : @mysql_connect($db_host, $db_username, $db_password) ) { if ( @mysql_select_db($db, $this->connect_id) ) { return TRUE; } return FALSE; } return FALSE; } function disconnect() { if ( @mysql_close($this->connect_id) ) { return TRUE; } return FALSE; } function query($query) { if ( $this->query_result = @mysql_query($query) ) { $this->num_queries++; return $this->query_result; } return FALSE; } function fetch_row($result, $type = 'ASSOC') { switch ( $type ) { case 'ASSOC' : if ( $this->query_rowset = @mysql_fetch_assoc($result) ) { return $this->query_rowset; } return FALSE; break; case 'ARRAY' : if ( $this->query_rowset = @mysql_fetch_array($result) ) { return $this->query_rowset; } return FALSE; break; case 'OBJECT' : if ( $this->query_rowset = @mysql_fetch_object($result) ) { return $this->query_rowset; } return FALSE; break; case 'ROW' : if ( $this->query_rowset = @mysql_fetch_row($result) ) { return $this->query_rowset; } return FALSE; break; } } function num_rows($result) { if ( $this->num_rows = @mysql_num_rows($result) ) { return $this->num_rows; } return FALSE; } function free_result($result) { @mysql_free_result($result); return; } function num_queries() { return $this->num_queries; } function escape($sql) { return @mysql_escape_string($sql); } } ?> |
From: Nick <sph...@us...> - 2005-06-09 01:39:33
|
Update of /cvsroot/phpgamedev/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24971 Added Files: readme.html Log Message: Initial commit of readme file. --- NEW FILE: readme.html --- <!-- $Id: readme.html,v 1.1 2005/06/09 01:39:24 sphen001 Exp $ --> <html> <head> <title>PHPGameDev DB Abstraction Layer</title> <link rel="stylesheet" href="style.css" type="text/css" /> </head> <body> <p class="titles" align="center">PHPGameDev DB Abstraction Layer Readme</p> <center><a href="http://phpgamedev.sourceforge.net/index.html">Back to Index</a></center> <br /> <table class="tablebg" width="90%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th colspan="2"> Feature List </th> </tr> <tr> <td class="nav" colspan="2" align="center"> Features of the PHPGameDev DB Abstraction Layer </td> </tr> <tr> <td class="row1" width="25%"> DB Layer Definition: </td> <td class="row2"> All of the DB layers support a type definition. You can use this definition to switch between code for different DBMS's. <br /><br /> For example, if you had a query that would not run in Oracle, you could use a switch to switch what code you use. <br /><br /> <pre> <span class="php_comment">// We have a query that will run on every DBMS except Oracle</span> <span class="php_keyword">switch</span> ( <span class="php_default">DB</span> ) { <span class="php_keyword">case</span> <span class="php_string">'MySQL'</span> : <span class="php_keyword">case</span> <span class="php_string">'MSSQL'</span> : <span class="php_default">$sql</span> = <span class="php_string">'Regular SQL code here'</span>; <span class="php_keyword">break</span>; <span class="php_keyword">case</span> <span class="php_string">'Oracle'</span> : <span class="php_default">$sql</span> = <span class="php_string">'Oracle specific SQL code here'</span>; <span class="php_keyword">break</span>; } </pre> </td> </tr> <tr> <td class="row1" width="25%"> Connection Type: </td> <td class="row2"> Supports both normal and persistent connections. </td> </tr> </table> <br /> <table class="tablebg" width="90%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th colspan="2"> Function Reference </th> </tr> <tr> <td class="nav" colspan="2" align="center"> Here we'll define all the functions and explain what they are used for. </td> </tr> <tr> <td class="row1" width="25%"> Function:<br />connect($db_host, $db_username, $db_password, $db, $persistent = FALSE) </td> <td class="row2"> This function connects to a DB. Only <b>$persistent</b> is not required. <br /><br /> <b>$db_host:</b> The hostname of the DB server you are connecting to. <br /> <b>$db_username:</b> The DB username you will be using. <br /> <b>$db_password:</b> The DB password you will be using. <br /> <b>$db:</b> The specific DB you will be accessing. <br /> <b>$persistent:</b> Open a persistent connection or not. Defaults to no. <br /><br /> Returns TRUE on success, and FALSE on failure. <br /><br /> <b>Example:</b> <br /> <pre> <span class="php_default">$db</span>-><span class="php_default">connect</span>(<span class="php_string">'localhost', 'root', '', 'some_db', FALSE)</span>; </pre> </td> </tr> <tr> <td class="row1" width="25%"> Function:<br />disconnect() </td> <td class="row2"> This function disconnects from a DB. You do not specify any arguments. <br /><br /> Returns TRUE on success, and FALSE on failure. <br /><br /> <b>Example:</b> <br /> <pre> <span class="php_default">$db</span>-><span class="php_default">disconnect</span>(); </pre> </td> </tr> <tr> <td class="row1" width="25%"> Function:<br />query($query) </td> <td class="row2"> This function executes a query on the DB. All arguments are required. <br /><br /> <b>$query:</b> The SQL query that is to be executed. <br /><br /> Returns the result on success, and FALSE on failure. <br /><br /> <b>Example:</b> <br /> <pre> <span class="php_default">$sql</span> = <span class="php_string">"SELECT *</span> <span class="php_string">FROM some_db</span> <span class="php_string">WHERE some_condition='some_condition'"</span>; <span class="php_default">$db</span>-><span class="php_default">query($sql)</span>; </pre> </td> </tr> <tr> <td class="row1" width="25%"> Function:<br />fetch_row($result, $type = 'ASSOC') </td> <td class="row2"> This function fetches a row from the DB. Only $result is required. <br /><br /> <b>$result:</b> The result of an executed SQL query. <br /> <b>$type:</b> The type of fetch_row you want to perform. Defaults to ASSOC. <br /><br /> <b>Types:</b> <br /><br /> <b>ASSOC:</b> Fetches an associative array (mysql_fetch_assoc()) <br /> <b>ARRAY:</b> Fetches an array (mysql_fetch_array()) <br /> <b>OBJECT:</b> Fetches an object (mysql_fetch_object()) <br /> <b>ROW:</b> Fetches a single row (mysql_fetch_row()) <br /><br /> Returns row on success, and FALSE on failure. <br /><br /> <b>Example:</b> <br /> <pre> <span class="php_keyword">while</span> ( <span class="php_default">$row</span> = <span class="php_default">$db</span>-><span class="php_default">fetch_row</span>(<span class="php_default">$result</span>, <span class="php_string">'ASSOC'</span>) ) { <span class="php_keyword">echo</span> <span class="php_default">$row</span>[<span class="php_string">'field_name'</span>]; } <span class="php_keyword">while</span> ( <span class="php_default">$row</span> = <span class="php_default">$db</span>-><span class="php_default">fetch_row</span>(<span class="php_default">$result</span>, <span class="php_string">'ARRAY'</span>) ) { <span class="php_keyword">echo</span> <span class="php_default">$row</span>[0]; } <span class="php_keyword">while</span> ( <span class="php_default">$row</span> = <span class="php_default">$db</span>-><span class="php_default">fetch_row</span>(<span class="php_default">$result</span>, <span class="php_string">'OBJECT'</span>) ) { <span class="php_keyword">echo</span> <span class="php_default">$row</span>-><span class="php_default">some_field</span>; } <span class="php_keyword">while</span> ( <span class="php_default">$row</span> = <span class="php_default">$db</span>-><span class="php_default">fetch_row</span>(<span class="php_default">$result</span>, <span class="php_string">'ROW'</span>) ) { <span class="php_keyword">echo</span> <span class="php_default">$row</span>[0]; } </pre> </td> </tr> <tr> <td class="row1" width="25%"> Function:<br />num_rows($result) </td> <td class="row2"> This function fetches the number of rows affected by the executed SQL query. All arguments are required. <br /><br /> <b>$result:</b> The result of an executed SQL query. <br /><br /> Returns number of rows on success, and FALSE on failure. <br /><br /> <b>Example:</b> <br /> <pre> <span class="php_keyword">echo</span> <span class="php_default">$db</span>-><span class="php_default">num_rows</span>(<span class="php_default">$result</span>); </pre> </td> </tr> <tr> <td class="row1" width="25%"> Function:<br />free_result($result) </td> <td class="row2"> This function frees up the memory associated with the executed SQL query. All arguments are required. <br /><br /> <b>$result:</b> The result of an executed SQL query. <br /><br /> Returns TRUE always. <br /><br /> <b>Example:</b> <br /> <pre> <span class="php_default">$db</span>-><span class="php_default">free_result</span>(<span class="php_default">$result</span>); </pre> </td> </tr> <tr> <td class="row1" width="25%"> Function:<br />num_queries() </td> <td class="row2"> This function returns the number of queries that were performed during the scripts execution. <br /><br /> Returns the number of queries performed. <br /><br /> <b>Example:</b> <br /> <pre> <span class="php_keyword">echo</span> <span class="php_default">$db</span>-><span class="php_default">num_queries</span>(); </pre> </td> </tr> <tr> <td class="row1" width="25%"> Function:<br />escape($sql) </td> <td class="row2"> This function escapes a SQL query. <br /><br /> Returns the escaped query <br /><br /> <b>Example:</b> <br /> <pre> <span class="php_default">$sql</span> = <span class="php_string">"SELECT *</span> <span class="php_string">FROM some_table"</span>; <span class="php_default">$sql</span> = <span class="php_default">$db</span>-><span class="php_default">escape</span>(<span class="php_default">$sql</span>); </pre> </td> </tr> </table> <br /> <table class="tablebg" width="90%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th colspan="2"> Variable Reference </th> </tr> <tr> <td class="nav" colspan="2" align="center"> Here are explanations of the variables used in the DB layer. </td> </tr> <tr> <td class="row1" width="25%"> <b>var $connect_id:</b> </td> <td class="row2"> Contains the connection details of the DB connection. </td> </tr> <tr> <td class="row1" width="25%"> <b>var $query_result:</b> </td> <td class="row2"> Contains the result of the executed SQL query. </td> </tr> <tr> <td class="row1" width="25%"> <b>var $query_rowset:</b> </td> <td class="row2"> Contains a row selected from the result of the executed SQL query. </td> </tr> <tr> <td class="row1" width="25%"> <b>var $num_rows:</b> <td class="row2"> Contains the number of affected rows. </td> </tr> <tr> <td class="row1" width="25%"> <b>var $num_queries:</b> </td> <td class="row2"> Contains the number of queries performed in the scripts execution. </td> </tr> </table> <br /> <table class="tablebg" width="90%" align="center" border="0" cellspacing="1" cellpadding="1"> <tr> <th>Example Script</th> </tr> <tr> <td class="nav" colspan="2" align="center"> An example script to demonstrate the features of this layer </td> </tr> <tr> <td class="row1"> <pre> <span class="php_comment">// Include the DB layer, and instantiate a new class</span> <span class="php_keyword">include</span> <span class="php_string">'./db_*.php'</span>; <span class="php_default">$db</span> = <span class="php_keyword">new</span> <span class="php_default">db</span>; <span class="php_comment">// Connect</span> <span class="php_default">$db</span>-><span class="php_default">connect</span>(<span class="php_string">'localhost'</span>, <span class="php_string">'root'</span>, <span class="php_string">''</span>, <span class="php_string">'db'</span>, <span class="php_keyword">FALSE</span>); <span class="php_comment">// Perform a query</span> <span class="php_keyword">switch</span> ( <span class="php_default">DB</span> ) { <span class="php_keyword">case</span> <span class="php_string">'MySQL'</span> : <span class="php_keyword">case</span> <span class="php_string">'MSSQL'</span> : <span class="php_default">$sql</span> = <span class="php_string">"SELECT *</span> <span class="php_string">FROM some_table"</span>; <span class="php_keyword">break</span>; <span class="php_keyword">case</span> <span class="php_string">'Oracle'</span> : <span class="php_default">$sql</span> = <span class="php_string">"Oracle specific code"</span>; <span class="php_keyword">break</span>; } <span class="php_default">$sql</span> = <span class="php_default">$db</span>-><span class="php_default">escape($sql)</span>; <span class="php_default">$result</span> = <span class="php_default">$db</span>-><span class="php_default">query($sql)</span>; <span class="php_comment">// Get the result set</span> <span class="php_keyword">while</span> ( <span class="php_default">$row</span> = <span class="php_default">$db</span>-><span class="php_default">fetch_row($result</span>, <span class="php_string">'ASSOC'</span>) ) { <span class="php_keyword">echo</span> <span class="php_default">$row</span>[<span class="php_string">'field_name'</span>]; } <span class="php_comment">// Get then number of affected rows and number of queries</span> <span class="php_keyword">echo</span> <span class="php_default">$db</span>-><span class="php_default">num_rows($result)</span>; <span class="php_keyword">echo</span> <span class="php_default">$db</span>-><span class="php_default">num_queries()</span>; <span class="php_comment">// Disconnect</span> <span class="php_default">$db</span>-><span class="php_default">disconnect()</span>; </pre> </td> </tr> </table> <br /> <center><a href="http://phpgamedev.sourceforge.net/index.html">Back to Index</a></center> |
From: Nick <sph...@us...> - 2005-06-09 01:34:46
|
Update of /cvsroot/phpgamedev/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22101 Added Files: readme.txt Log Message: Initial commit of readme file. --- NEW FILE: readme.txt --- /**************************************************/ /* /* Readme for PHPGameDev DB Abstraction Layer /* $Id: readme.txt,v 1.1 2005/06/09 01:34:37 sphen001 Exp $ /**************************************************/ You can find an online version of this readme at: http://phpgamedev.sourceforge.net/docs/db_readme.html Feature List: Features of the PHPGameDev DB Abstraction Layer DB Layer Definition: All of the DB layers support a type definition. You can use this definition to switch between code for different DBMS's. For example, if you had a query that would not run in Oracle, you could use a switch to switch what code you use. <?php // We have a query that will run on every DBMS except Oracle switch ( DB ) { case 'MySQL' : case 'MSSQL' : $sql = 'Regular SQL code here'; break; case 'Oracle' : $sql = 'Oracle specific SQL code here'; break; { ?> Connection Type: Supports both normal and persistent connections. Function Reference: Here we'll define all the functions and explain what they are used for. Function: connect($db_host, $db_username, $db_password, $db, $persistent = FALSE) This function connects to a DB. Only $persistent is not required. $db_host: The hostname of the DB server you are connecting to. $db_username: The DB username you will be using. $db_password: The DB password you will be using. $db: The specific DB you will be accessing. $persistent: Open a persistent connection or not. Defaults to no. Returns TRUE on success, and FALSE on failure. Example: <?php $db->connect('localhost', 'root', '', 'some_db', FALSE); ?> Function: disconnect() This function disconnects from a DB. You do not specify any arguments. Returns TRUE on success, and FALSE on failure. Example: <?php $db->disconnect(); ?> Function: query($query) This function executes a query on the DB. All arguments are required. $query: The SQL query that is to be executed. Returns the result on success, and FALSE on failure. Example: <?php $sql = "SELECT * FROM some_db WHERE some_condition='some_condition'"; $db->query($sql); ?> Function: fetch_row($result, $type = 'ASSOC') This function fetches a row from the DB. Only $result is required. $result: The result of an executed SQL query. $type: The type of fetch_row you want to perform. Defaults to ASSOC. Types: ASSOC: Fetches an associative array (mysql_fetch_assoc()) ARRAY: Fetches an array (mysql_fetch_array()) OBJECT: Fetches an object (mysql_fetch_object()) ROW: Fetches a single row (mysql_fetch_row()) Returns row on success, and FALSE on failure. Example: <?php while ( $row = $db->fetch_row($result, 'ASSOC') ) { echo $row['field_name']; } while ( $row = $db->fetch_row($result, 'ARRAY') ) { echo $row[0]; } while ( $row = $db->fetch_row($result, 'OBJECT') ) { echo $row->some_field; } while ( $row = $db->fetch_row($result, 'ROW') ) { echo $row[0]; { ?> Function: num_rows($result) This function fetches the number of rows affected by the executed SQL query. All arguments are required. $result: The result of an executed SQL query. Returns number of rows on success, and FALSE on failure. Example: <?php echo $db->num_rows($result); ?> Function: free_result($result) This function frees up the memory associated with the executed SQL query. All arguments are required. $result: The result of an executed SQL query. Returns TRUE always. Example: <?php $db->free_result($result); ?> Function: num_queries() This function returns the number of queries that were performed during the scripts execution. Returns the number of queries performed. Example: <?php echo $db->num_queries(); ?> Function: escape($sql) This function escapes a SQL query. Returns the escaped query Example: <?php $sql = "SELECT * FROM some_table"; $sql = $db->escape($sql); ?> Variable Reference: Here are explanations of the variables used in the DB layer. var $connect_id: Contains the connection details of the DB connection. var $query_result: Contains the result of the executed SQL query. var $query_rowset: Contains a row selected from the result of the executed SQL query. var $num_rows: Contains the number of affected rows. var $num_queries: Contains the number of queries performed in the scripts execution. Example Script: An example script to demonstrate the features of this layer. <?php // Include the DB layer, and instantiate a new class include './db_*.php'; $db = new db; // Connect $db->connect('localhost', 'root', '', 'db', FALSE); // Perform a query switch ( DB ) { case 'MySQL' : case 'MSSQL' : $sql = "SELECT * FROM some_table"; break; case 'Oracle' : $sql = "Oracle specific code"; break; } $sql = $db->escape($sql); $result = $db->query($sql); // Get the result set while ( $row = $db->fetch_row($result, 'ASSOC') ) { echo $row['field_name']; } // Get then number of affected rows and number of queries echo $db->num_rows($result); echo $db->num_queries(); // Disconnect $db->disconnect(); ?> |