Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/26/2021 in all areas

  1. What's the code for saving the passwords into the table in the first place? It uses password_hash, right? Also, don't put variables into queries like you're doing with $userid. Learn about prepared statements and start using them immediately.
    1 point
  2. This would be the fastest way $local = PDO connection to database on local db server $remote = PDO connection to database on remote server // // GET DATA FROM LOCAL SERVER // $res = $local->query("SELECT user_id, user_username FROM users"); $users = []; foreach ($res as $row) { $users[] = vsprintf("(%d, '%s')", $row); } // // WRITE DATA TO REMOTE SERVER // 1,000 RECORDS AT A TIME // $chunks = array_chunk($users, 1000); $count = 0; foreach ($chunks as $data) { $count += $remote->exec("INSERT INTO users (id, username) VALUES " . join(',', $data)); } echo "$count records transferred";
    1 point
  3. You don't need JSON data (unless you actually want to store JSON data). Use two database connections - one to the local database, another to the cloud one - then loop through the data from the local one and insert it into the cloud one: $insertDB -> prepare('insert into cloud_users values ( :id, :username )'); $readDB -> prepare('select id, username from users order by 1'); $readDB -> execute(); while ( $row = $readDB -> fetch() ) { $insertDB -> execute( [ 'id' => $row['id'], 'username' => $row['username'] ] ); } Regards, Phill W.
    1 point
This leaderboard is set to New York/GMT-04:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.