Member data import uchome program instance _ PHP Tutorial

Source: Internet
Author: User
Import member data to the uchome program instance. Member data imported into uchome program instance? Phptry {$ uc_dbnewDataSource (UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, mysql, true); $ uc_querynewDbQueryForMysql ($ uc_db);} import cat member data to uchome program instances

Try {
$ Uc_db = new DataSource (UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME,

'Mysql', true );
$ Uc_query = new DbQueryForMysql ($ uc_db );

} Catch (DbException $ e ){
// Database error handling
Exit ('database support needed ');
}

$ SQL = "select * from 111cn_member ";
$ Db = new Db ();
$ Array = $ Db-> query ($ Db, 0 );

Foreach ($ array as $ _ v => $ value)
{
$ Data = $ Db-> query ("SELECT * FROM". UC_DBTABLEPRE. "members WHERE

Username = '". $ rs ['username']."' ");
If ($ data ){
$ Ucuserlist. = "username:". $ rs ['username']. "email:". $ rs

['Email ']. "rn ";
} Else {
$ Salt = substr (uniqid (rand (),-6 );
$ Password = md5 ($ rs ['passwd']. $ salt );

$ Db-> query ("insert into". UC_DBTABLEPRE. "members SET uid =

'". $ Rs ['id']."', username = '". $ rs ['username']."', password = '$ password ',

Email = '". $ rs ['email']." ', lastlogintime =' ". $ rs ['last _ login']." ',

Regdate = '". $ rs ['add _ time']."', salt = "$ salt "");
$ Db-> query ("insert into". UC_DBTABLEPRE. "memberfields SET

Uid = '". $ rs ['id']."' ");
}

}
Exit ("Ucenter imported by user ");

?>


Why? Php try {$ uc_db = new DataSource (UC_DBHOST, UC_DBUSER, UC_DBPW, UC_DBNAME, 'mysql', true); $ uc_query = new DbQueryForMysql ($ uc_db);} cat...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.