below script for connection PHP to database MSSQL Server 2005 and MYSQL , just changes the "s" to "y"
alert('DB Connection error!');");
mysql_select_db($sqlDb, $sqlCon);
/**
* Use to perform SELECT to MYSQL Server
*
* @param String $strQuery
* @return Array $sqlRow
*/
function singleSelect($strQuery) {
global $sqlCon;
$sqlRs = mysql_query($strQuery, $sqlCon);
$sqlRow = array();
$idx = 1;
while ($row = mysql_fetch_array($sqlRs)) {
$sqlRow[$idx++] = $row;
}
mysql_free_result($sqlRs);
return $sqlRow;
}
/**
* Use to perform SELECT to MYSQL Server
*
* @param Array $arrQuery
* @return Array $sqlRows
*/
function multiSelect($arrQuery) {
global $sqlCon;
$sqlRs = mysql_query(implode("\n", $arrQuery), $sqlCon);
$sqlRows = array();
$idx = 1;
$idxs = 1;
do {
$sqlRow = array();
while ($row = mysql_fetch_array($sqlRs)) {
$sqlRow[$idx++] = $row;
}
$sqlRows[$idxs++] = $sqlRow;
$idx = 1;
} while (mysql_next_result($sqlRs));
mysql_free_result($sqlRs);
return $sqlRows;
}
/**
* Use to perform INSERT, UPDATE, and DELETE to MYSQL Server
*
* @param String $strQuery
* @return Array $sqlRow
*/
function singleUpdate($strQuery) {
global $sqlCon;
mysql_query($strQuery, $sqlCon);
}
/**
* Use to perform INSERT, UPDATE, and DELETE to MYSQL Server
*
* @param Array $arrQuery
* @return Array $sqlRow
*/
function multiUpdate($arrQuery) {
global $sqlCon;
mysql_query(implode("\n", $arrQuery), $sqlCon);
}
?>
Sunday, February 22, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment