Jump to content

[SOLVED] Very Strange - values in MySQL columns aren't what they are suppose to be?


MasterACE14

Recommended Posts

Evening PHP Freaks,

 

I have a file which is suppose to UPDATE every user's 'money' column, but the SELECT's I am using for every person isn't getting the right value.

 

here is the basics of the script:

<?php
// Workout the Players Income //
$players_income = ($all_supplydrop_amount * $all_supplysize_amount);


/****** Give Players their Income ******/

// SQL query to update the players account into the database
$sqlzx = "UPDATE `cf_users` SET `money`=`money`+{$players_income}";

 

now, I'm not really interested in using my variables that SELECT to complete this, but are more interested in letting MySQL do the maths instead.

 

The only problem is I need 2 columns from my `cf_users2` table, and I am updating `money` column in `cf_users`.

 

So, if they were in the same table I would do the query like this:

<?php
$sqlzx = "UPDATE `cf_users` SET `money`=`money`+`amount_supplydrop`*`amount_supplysize`";

how can I do the same query above, but with `amount_supplydrop` and `amount_supplysize` which are actually in the `cf_users2` table???

 

I'm sure this is simple, but I just don't know how  :P

 

any help is greatly(like always) appreciated  ;D

 

Regards ACE

Link to comment
Share on other sites

How does this relate to the topic title?

 

You can try this:

 

$sqlzx = "UPDATE `cf_users`,`cf_users2` SET `cfusers`.`money`= `cfusers`.`money`+ `cfusers2`.`amount_supplydrop`*`cfusers2`.`amount_supplysize` WHERE cfusers.id = cfusers2.id";

 

Btw, in most cases the quotes aren't needed.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.