MYSQL数据库电话号码表记录处理代码片段
自己给朋友做的一个处理,临时用的一个代码片段,记录一下,以备不时之需。其中用到了几个正则表达式和部分foreach循环。
ignore_user_abort (true);
set_time_limit (0);
class mysql
{
public $fetch_mode = MYSQL_BOTH;
public $record = array( );
public $count = NULL;
public function __construct( )
{
$this->connect( );
}
public function connect( )
{
if ( !( $this->link = mysql_connect( "localhost", "root", "" ) ) )
{
exit( mysql_error( ) );
}
mysql_query( "SET NAMES UTF8" );
if ( !mysql_select_db( "two", $this->link ) )
{
exit( "未能找到数据库:" );
}
}
public function ping( )
{
if ( !mysql_ping( $this->link ) )