Quoting Aaron Wolski <[EMAIL PROTECTED]>:
> Here's some functions I use in my development which save on connect and
> query calls for me.
>
> //General Purpose Utilities.
> //db_connect connects to the database server and selects the proper
> database.
> //Arguments: None
> //Returns: Nothing
>
>
> function db_connect() {
>
> mysql_pconnect("localhost","username","password");
> mysql_select_db("Database");
>
> }
>
>
> //db_query queries the database server and returns the results.
> //Arguments: SQL query string
> //Returns: Query results
>
> function db_query($query) {
>
> return mysql_query($query);
>
> }
>
>
> //db_fetch returns the next set of results from a db_query.
> //Arguments: db_query results variable
> //Returns: Next set of query results as an array or 0 if no further
> results are present
>
>
> function db_fetch($results) {
>
> return mysql_fetch_array($results);
>
> }
>
>
> //db_numrows returns the number of rows selected from a query.
> //Arguments: query result
> //Returns: number of rows in the query result
>
> function db_numrows($result) {
>
> return mysql_num_rows($result);
>
> }
>
>
> //Always connect to the database!
>
> db_connect();
>
>
> Keep these in an include file. The db_connect(); goes at the bottom and
> keep the connection open during the routines.
>
>
> To call db_query you would use it like:
>
> $someQuery = db_query("SELECT * from someTable ....");
>
>
> to get the results out of the query you would call db_fetch and use it
> like:
>
>
> $someResult = db_fetch($someQuery);
>
> If you needed to return an array you would use it with a while or for
> statement like:
>
> While ($someResult = db_fetch($someQuery)) {
>
> }
>
> If you needed to get the number of rows from the query you'd use like:
>
> numRows = db_numrows($someQuery);
>
> or
>
> if (db_numrows($someQuery) > ...)
>
>
> These are just some thing I use to make my life easier.
>
> Hope it helps
>
Not to be rude... but what does that have to do with his question?
--
Adam Alkins
http://www.rasadam.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php