How can I have data go to another table?

In the php file this works successfully:

        // add data to table
        $insert_buy = $db->insert('u_paid_videos', [
        'id_user' => $user_id,
        'video_play_price' => (string)$video_cost_new,
        'id_video' => $video_id,
        'user_id_uploaded' => $video->user_id,
        'video_title' => $video->title,
        'earned_amount' => $up_amount,
        'time' => $time_start,
        'short_id' => $video->short_id,
        'session_key' => $_SESSION['session_key']
        ]);

I’d like to add this data to a different table that has these columns:

id, user_id, paid_id, video_id, amount, admin_com, time

So, I tried this replacement without success:

$insert_buy = $db->insert('videos_transactions', [
'user_id' => $user_id,
'video_id' => $video_id,
'video_play_price' => $amount,
'user_id_uploaded' => $paid_id,
'earned_amount' => $admin_com,
'time' => $time
]);

I’m not well-versed in this, so any guidance with this is welcomed.

Well, first of all, normally you use ID or id as an auto-increment field. This field is for use in displays, but, you don’t ever insert it. You let the database system handle that. Also, have you looked at the table structure to make sure all of those new fields are actually in the database.

Perhaps we should do it this way: What was the error you are getting?

My suggestion would to look at https://phpdelusions.net/pdo as it should give you a good start.

resolved-- – – – –

Sponsor our Newsletter | Privacy Policy | Terms of Service