note 48049 deleted from function.mysql-connect by betz
| From: | betz@php.net | Date: | Fri, 10 Dec 2004 11:50:15 +0000 |
| Subject: | note 48049 deleted from function.mysql-connect by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-81638@lists.php.net to get a copy of this message | ||
Note Submitter: webmaster at elcurriculum dot com
----
This function executes a SQL sentence.
define("_HOST","localhost"); //Host BD...
define("_BD","admin"); //BD...
define("_USR",""); //User...
define("_PSR",""); //Password...
....
....
function BDConexion($sSQL) {
mysql_connect(_HOST, _USR, _PSR);
$result = mysql_db_query(_BD, $sSQL);
return @$result;
mysql_free_result($result);
}
Examples:
//Insert
BDConexion("INSERT INTO ... VALUES ....");
//Updates
BDConexion("UPDATE SET ... WHERE ....");
//Queries
$result = BDConexion("SELECT * FROM ... WHERE ...");
while (mysql_fetch_array($result) = $r) {
echo $r["data"];
}
More:
http://tryke.blogcindario.com
----
Reason: useless example