本文整理汇总了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 » Field <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;
?>
示例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