that didn’t succeed.
The seller is identified by the videos table id, (video->user_id), but the seller’s wallet is in the users table users-> wallet. So, I’m not sure if I’m connecting the two properly.
Thanks for that, yes I understand. Much appreciated. However, this does not succeed:
//update the 'wallet' of the user who uploaded the video(seller)
// get the uploader's record
$up_user_start1 = $db->where('id', $video->user_id)->getOne(T_USERS);
// add to the seller's balance
$uploader_account1 = $up_user_start1->wallet;
$upwallet = ($sell_video == 0 && $uploader_account1 >= 1 ? .5 : 0);
$db->rawQuery("UPDATE ".T_USERS." SET `wallet` = `wallet`- '".$upwallet."' WHERE `id` = '".$video->user_id." ' ");
The biggest issue I notice in this query is the space before the single quote. It is adding a space after the number so it wouldn’t match a record, e.g. '12 ' instead of '12'. Notice the difference from the “working” query in POST #12.
//update the 'wallet' of the user who uploaded the video(seller)
// get the uploader's record
$up_user_start1 = $db->where('id', $video->user_id)->getOne(T_USERS);
// add to the seller's balance
$uploader_account1 = $up_user_start1->wallet;
$upwallet = ($sell_video == 0 && $uploader_account1 >= 1 ? .5 : 0);
$db->rawQuery("UPDATE ".T_USERS." SET `wallet` = `wallet`-'".$upwallet."' WHERE `id` = '".$video->user_id." ' ");
since “//get the uploader’s record” was earlier in the file as:
When developing you need to do your own testing of values by echoing them just like we did for $wallet and then found it missing. SO just for testing, add a test echo right above your update query. If you can’t just do echo then set an $error variable just so we can check values.