Hello,

I followed the tutorial from this site here and have added the login/registration to my test site.
The problem is I now need to add two currencies to each user. On the database I have created two rows for 'invested' and 'return' and need these to be unique to each user. I played around with various bits last night and managed to show the top row for ALL users, but not each user their own figures. I tried to do it myself by trial and error but I'm stuck.

From what I can see this login/registration is quite popular, so I'm hoping somebody could shed some light on what exactly I need to be looking at.

Thanks for reading

Recommended Answers

All 9 Replies

Yes, i agree with pritaeas. It is going to be far easier to get help if you include at least the structure of the db table and a sample of the code you're using.

I'd bet you'll have to do a foreach loop inside a while loop, but that's just a stab in the dark without seeing what you're actually dealing with.

Hello,

Sorry for the late reply I've been swamped with work.
I have uploaded the PHP to pastebin since I've also asked this somewhere else.

http://pastebin.com/gpnFDV2D

In the table I have the following (sorry, I'm not entirely sure what I should show you)

id_user
name
email
phone_number
username
password
confirmcode
invested
return

I'm still learning the basics, most of this is blowing my mind.

Hello,

Just wondering if anyone could help me with this, I've been trying to do it myself but I haven't found any tutorials/guides on how to easily add this.

In the table I have the following (sorry, I'm not entirely sure what I should show you)

Show some sample data (what's in the table), and clearly state what you want as output.

Hi Pritaeas,

At the moment I have two records in the table 'fgusers3', these are registered users with the following data;

userid, name, email, phone_number, username, password, confirmcode, invested, return
1, Bill Gates, email@email.com, 07777777777, test, md5 hash, y, 100.00, 10.00
2, Sam Daar, test@email.com, 00000000000, admin, md5 hash, y, 50.00, 20.00

I need this to show each individual user their "invested" and "return" amount. So for example Bill Gates would show "invested 100.00, return 10.00". Sam Daar would show "invested 50.00, return 20.00"

Thank you for your help

Following my previous post, I am trying to figure out where and how to add this function in the php code (on pastebin above).

Any help would be greatly appreciated, I'd consider donating a coffee to someone too :)

You'll need to copy for example the CheckLoginInDB function. The query you'll need would be this I guess:

function getInvestment($username)
{
    // open database, etc.

    $qry = "SELECT * FROM fgusers3 WHERE username='$username'";

    // get the result and do something with it.        
}

I am still trying to figure this out correctly. I have linked below the page where this all appears. The PHP on this page is correctly pulling the 'invested' and 'return' through fine, although only the top row - I did this purely to play with, however, I now have no idea how to get your suggestion to display correctly on this page.

Web page this is being displayed on: http://pastebin.com/NRsVdEjJ

Below is what I have so far, taken from what I've read online. I'm sure it's wrong though. I took bits from the CheckLoginInDB function.

    function getInvestment($username)
    {
    $qry = "SELECT donated, profit FROM $this->tablename where username='$username'";
    $row = mysql_fetch_array($qry;)
    $invested = $row['invested'];
    $return = $row['return'];
    }

Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.