Prepared statement
===

Im new to MySQLi but my logic below seems sound. Im trying to copy clients from one database to another; but its not working. This is the DB Im copying -from-:

    +-------------------+------------------+------+-----+---------+----------------+
    | Field             | Type             | Null | Key | Default | Extra          |
    +-------------------+------------------+------+-----+---------+----------------+
    | id                | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
    | client            | varchar(100)     | YES  |     | NULL    |                |
    | telephone         | varchar(14)      | YES  |     | NULL    |                |
    | physical_address  | text             | YES  |     | NULL    |                |
    | email             | varchar(100)     | YES  |     | NULL    |                |
    | contact           | varchar(100)     | YES  |     | NULL    |                |
    +-------------------+------------------+------+-----+---------+----------------+

Here is my PHP script:

    <?php	
    set_time_limit(0);
    
    date_default_timezone_set('Africa/Johannesburg');
    include('_cli_functions.php');
    
    echo "Starting conversion...\n";
    
    $billing_db = new mysqli('localhost','root','pass','billing');
    if ($billing_db->connect_error)
      die('Billing db connection error');
    else
      echo "Connected to billing db\n";
    
    $whmcs_db = new mysqli('localhost','root','pass','whmcs');
    if ($whmcs_db->connect_error)
      die('WHMCS db connection error');
    else
      echo "Connected to WHMCS db\n";
    
    if (!$client_result = $billing_db->query('SELECT id,SUBSTRING_INDEX(contact, " ", 1) AS firstname,
    SUBSTRING(contact FROM LOCATE(" ",contact)+1) AS lastname,client,SUBSTRING_INDEX(TRIM(contact_email), ";", 1) AS email, 
    physical_address,telephone FROM clients ORDER BY id'))
      die("Error: ". $billing_db->error);
    
    if ($client_result->num_rows==0)
      echo "No clients to convert\n";
    elseif (!$client_insert_stmt = $whmcs_db->prepare('INSERT INTO tblclients (id,firstname,lastname,companyname,email,address1,country,
    phonenumber,password,currency,datecreated) values (?,?,?,?,?,?,"ZA",?,?,1,"'. date('Y-m-d') .'")'))
      printf("Prepared Statement Error: %s\n", $whmcs->error);	
    
    $client_insert_stmt->bind_param('isssssss', $client_data['id'], $client_data['firstname'], $client_data['lastname'], 
    $client_data['client'], $client_data['email'], $client_data['physical_address'], $client_data['telephone'], $password);
      
    $count = 0;
    while ($client_data = $client_result->fetch_assoc())
    {	
// this is just for debugging
    echo $client_data['id'], $client_data['firstname'], $client_data['lastname'], $client_data['client'], $client_data['email'], $client_data['physical_address'], $client_data['telephone'], $password;
      $password=generatePassword();
      if (!$client_insert_stmt->execute())
        die("\n".$client_insert_stmt->error."\n");
    
      $count++;
      show_status($count, $client_result->num_rows);	
    }
    $client_insert_stmt->close();	
    echo $client_result->num_rows ." clients processed.\n\n";
    ?>

However, here is my output:

    Starting conversion...
    Connected to billing db
    Connected to WHMCS db
    1BillyBobCompany inc.a@b.co.za 123 Whatever Avenue(000) 000-0000
    Column 'firstname' cannot be null

As you can see, its outputting the info thats getting binded, so what am I doing wrong?