Jump to content

David Varen

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by David Varen

  1. 11 hours ago, Ingolme said:

    You don't have to. The money_transfer table should have its own user_id field by which you search for records.

    you don't understand what I'm asking. 

    please see the attached file and maybe you will understand.

    bank.zip

  2. 21 minutes ago, Ingolme said:

    The money_transfer table must have a user_Id field. Does it have a user_id field?

    how do i match the userid field from users to mony_transfer?

  3. 23 hours ago, Ingolme said:

    It is not clear what you are trying to accomplish and I have no idea what your database table structure is.

    Assuming the money_transfer table has a user_id field, here's how to get all transfers for a user: SELECT * from money_transfer WHERE user_id = 5

    I need to do the action "SELECT transferid,SUM(despoit-transferAmount) AS money from money_transfer" WHERE userid=$_SESSION[userid].

    the userid is in the users table.

    how do I combined the two tables so the action will work? 

     

  4. On 4/23/2020 at 11:57 PM, Ingolme said:

    Have a field in the money_transfer table with the ID of the user involved. I'm not sure if I understood the question since this is trivial.

    how this mysql supposed to look like?

         $mysqli = new mysqli("localhost","root",'',"bank");

    if ($mysqli -> connect_errno) {
      echo "Failed to connect to MySQL: " . $mysqli -> connect_error;
      exit();
    }

    $sql ="SELECT userid FROM users WHERE userid=$_SESSION[userid] UNION SELECT SUM(despoit-transferAmount) AS money from money_transfer";

    if ($result = $mysqli -> query($sql)) {
     
     while ($obj = $result -> fetch_assoc()) {
        printf($obj->money."$");
      }
      $result -> free_result();
    }

    $mysqli -> close();

  5. Hi,

    I have users table with userid column and money_transfer table which all the financial operations are in it.

    how can I make that every financial operation which I make in money_transfer table will be connected to every user separately?

  6. Hi,

    I have users table with userid column and money_transfer table which all the financial operations are in it.

    how can I make that every financial operation which I make in money_transfer table will be connected to every user separately?

×
×
  • Create New...