當前位置: 首頁>>代碼示例>>PHP>>正文


PHP sql_db::sql_close方法代碼示例

本文整理匯總了PHP中sql_db::sql_close方法的典型用法代碼示例。如果您正苦於以下問題:PHP sql_db::sql_close方法的具體用法?PHP sql_db::sql_close怎麽用?PHP sql_db::sql_close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sql_db的用法示例。


在下文中一共展示了sql_db::sql_close方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1:

			// Let's remove BLOB and BINARY for now...
			//if ((strpos(strtolower($field_type), 'char') !== false) || (strpos(strtolower($field_type), 'text') !== false) || (strpos(strtolower($field_type), 'blob') !== false) || (strpos(strtolower($field_type), 'binary') !== false))
			if ((strpos(strtolower($field_type), 'char') !== false) || (strpos(strtolower($field_type), 'text') !== false))
			{
				//$sql_fields = "ALTER TABLE {$db->sql_escape($table)} CHANGE " . $db->sql_escape($field_name) . " " . $db->sql_escape($field_name) . " " . $db->sql_escape($field_type) . " CHARACTER SET utf8 COLLATE utf8_bin";

				$sql_fields = "ALTER TABLE {$db->sql_escape($table)} CHANGE " . $db->sql_escape($field_name) . " " . $db->sql_escape($field_name) . " " . $db->sql_escape($field_type) . " CHARACTER SET utf8 COLLATE utf8_bin " . (($field_null != 'YES') ? "NOT " : "") . "NULL DEFAULT " . (($field_default != 'None') ? ((!empty($field_default) || !is_null($field_default)) ? (is_string($field_default) ? ("'" . $db->sql_escape($field_default) . "'") : $field_default) : (($field_null != 'YES') ? "''" : "NULL")) : "''");
				$db->sql_query($sql_fields);

				echo("\t&nbsp;&nbsp;&raquo;&nbsp;Field&nbsp;<b style=\"color: #4488aa;\">$field_name</b> (in table <b style=\"color: #009900;\">$table</b>) converted to UTF-8<br />\n");
			}
		}
		echo("<br />\n");
		flush();
	}
}

$db->sql_close();

echo("<br />\n<br />\n<br />\n<b style=\"color: #dd2222;\">Work Complete!!!</b><br />\n");

// HTML FOOTER - BEGIN
echo("</div>\n");
echo("</body>\n");
echo("</html>\n");
// HTML FOOTER - BEGIN

flush();
exit;

?>
開發者ID:ALTUN69,項目名稱:icy_phoenix,代碼行數:31,代碼來源:convert_utf8.php

示例2: UpdateAddConEmail


//.........這裏部分代碼省略.........
		LogError( $lang[ "ErrDBEmail" ], false );
		return false;
		}

	//first see if the email addresses are different
	if (  $newemail != $oldemail )
		{
		//first check to see if the new address is in the optUsers table, under a different userid if so we return false
		$query	= "select UserID from optUsers where EmailAddress = '$newemail' and UserID != $userid";

		if ( !$result = $dbsupport->sql_query( $query ) )
			{
			LogError( 9136, $query ."<br>".$dbsupport->sql_error(), false );
			return false;
			}

		if ( $dbsupport->sql_numrows( $result ) > 0 )
			{
			LogError(  $lang[ "ErrEmailExists" ], false );
			return false;
			}

			//grab all company DBs linked to this user
			$query	= "select optUserCompany.DBName, DBHost from optUserCompany, optUserLinks where optUserLinks.UserID = $userid
							and optUserLinks.CompanyID = optUserCompany.CompanyID";

			if ( !$result = $dbsupport->sql_query( $query ) )
				{
				LogError( 9138, $query ."<br>".$dbsupport->sql_error(), false );
				return false;
				}

			//04.09.2013 naj - changed everything to use a transaction, so we can roll this back if it fails
			$dbarray = array();
			while ( $dbrow	= $dbsupport->sql_fetchrow( $result ) )
				{
				$tempdb = new sql_db( $dbrow[ "DBHost" ], $dbuser, $dbpasswd, $dbrow[ "DBName" ], false, true );
				if ( $tempdb->db_connect_id )
					{
					//04.09.2013 naj - add the current database to the db array.
					$dbarray[] = $tempdb;
					if ( !$tempresult = $tempdb->sql_query( '', 'BEGIN'))
						{
						LogError (12118, $query."<br>".$tempdb->sql_error());
						foreach ($dbarray as $tempdb)
							{
							$tempdb->sql_query('', 'ROLLBACK');
							$tempdb->sql_close();
							}
						return false;
						}

					$query	= "update conAdditionalContacts set EmailAddress = '".$newemail."' where EmailAddress = '".$oldemail."' and UserID = $userid";
						
					if ( !$tempresult = $tempdb->sql_query( $query ) )
						{
						LogError( 9139, $query."<br>".$tempdb->sql_error() );
						foreach ($dbarray as $tempdb)
							{
							$tempdb->sql_query('', 'ROLLBACK');
							$tempdb->sql_close();
							}
						return false;
						}
					}
				}

			//now update the optUsers record
			$query	= "update optUsers set EmailAddress  = '".$newemail."' where UserID = $userid";

			if ( !$result = $dbsupport->sql_query( $query ) )
				{
				LogError( 9140, $query ."<br>".$dbsupport->sql_error(), false );
				foreach ($dbarray as $tempdb)
					{
					$tempdb->sql_query('', 'ROLLBACK');
					$tempdb->sql_close();
					}
				return false;
				}	

			//04.09.2013 naj - if we made it this far, then the update is complete.
			foreach ($dbarray as $tempdb)
				{
				$tempdb->sql_query('', 'COMMIT');
				$tempdb->sql_close();
				}

		//12.09.2013 naj - this is to ensure that the current database gets updated to in the event that the user was allowed to login in the past but now is not.
		$query	= "update conAdditionalContacts set EmailAddress = '".$newemail."' where EmailAddress = '".$oldemail."' and UserID = $userid";
		if ( !$result = $db->sql_query( $query ) )
			{
			LogError(13858, $query ."<br>".$db->sql_error(), false );
			return false;
			}
		}
	}

return true;
}//end of UpdateAddConEmail
開發者ID:rhancock1223,項目名稱:merxphp,代碼行數:101,代碼來源:general_functions-bak.php


注:本文中的sql_db::sql_close方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。