note 55949 deleted from ref.mysql by aidan
| From: | aidan@php.net | Date: | Fri, 19 Aug 2005 01:05:08 +0000 |
| Subject: | note 55949 deleted from ref.mysql by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-93866@lists.php.net to get a copy of this message | ||
Note Submitter: DGBaley27 $A$T$ comcast $D$O$T$ -n-e-t-
Reason: useless
----
I find the following functions helpful in all my php/mysql applications:
function sql($SQL, $db='default') {
$link = mysql_connect($MySQL_Server, $MySQL_User, $MySQL_PW);
mysql_select_db($db, $link);
$result = mysql_query($SQL, $link);
mysql_close($link);
return $result;
} // end sql()
function sqlOne($SQL, $db) {
$result = sql($SQL, $db);
$row = mysql_fetch_array($result);
return $row;
} // end sqlOne()
function sqlOneField($field, $SQL, $db) {
$result = sqlOne($SQL, $db);
$row = mysql_fetch_array($result);
return $row[$field];
} // end sqlOneField()
//Each function builds on the next and provides quick access to a result resource, table row, or
specific field respectively.
//This assures that all links to the database are closed.