How do i collect just one type of currency from the users_currency table and can i add it to the template.class

nateforever96

Member
Apr 11, 2021
59
19
$currencyData = mysql_fetch_array(mysql_query("SELECT * FROM users_currency WHERE user_id = '".$_SESSION['user']['id']."'"));
this is far as my logic goes with the pulling i am use to simple and when i have to pull a tables value only at the session user i get confused one person can get me a far way right now the tables are
Users_Currencys
values
Users_Id , Type , Amount

credits are type 0
diamonds 5



P.S. im trying to reconvert this and bring it back

if(isset($_POST['BuyRoll'])){
$userData = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE id = '".$_SESSION['user']['id']."'"));
$currencyData = mysql_fetch_array(mysql_query("SELECT * FROM users_currency WHERE user_id = '".$_SESSION['user']['id']."'"));
$Purchase = '5000';
if($userData['credits'] < $Purchase){
echo "Not Enough Credits</br></br>";
}else{
mysql_query("UPDATE users SET credits = credits - $Purchase WHERE id = '".$_SESSION['user']['id']."'");
$LotControl = mysql_fetch_array(mysql_query("SELECT * FROM LotteryControls"));
if ($userData['online'] == 0){
$testUsers = mysql_query("SELECT * from user_lottery WHERE user_id = '". $_SESSION['user']['id'] ."' LIMIT 1");
if(mysql_num_rows($testUsers) > 0){
 
Solution
For duckets the currency is 0, the credits are stored in the uses table. Use this to get duckets currency, change accordingly for your currency needed.
PHP:
<?php
                        $users_a = mysql_query("SELECT * FROM users INNER JOIN users_currency ON users.id=users_currency.user_id AND users_currency.type = '0' WHERE `rank` <= '8' ORDER BY users_currency.amount DESC LIMIT 5");
                        while($users = mysql_fetch_assoc($users_a)){
                            $row = mysql_fetch_assoc($row = mysql_query("SELECT * FROM users WHERE id = '".$users['id']."' LIMIT 5"));
                        ?>
P.S that’s a code for leaderboards.

boz

don daddy
Mar 23, 2021
152
74
For duckets the currency is 0, the credits are stored in the uses table. Use this to get duckets currency, change accordingly for your currency needed.
PHP:
<?php
                        $users_a = mysql_query("SELECT * FROM users INNER JOIN users_currency ON users.id=users_currency.user_id AND users_currency.type = '0' WHERE `rank` <= '8' ORDER BY users_currency.amount DESC LIMIT 5");
                        while($users = mysql_fetch_assoc($users_a)){
                            $row = mysql_fetch_assoc($row = mysql_query("SELECT * FROM users WHERE id = '".$users['id']."' LIMIT 5"));
                        ?>
P.S that’s a code for leaderboards.
 
Solution

nateforever96

Member
Apr 11, 2021
59
19
If your wanting just 1 currency ("SELECT (the currency u want to fetch) FROM users Where user_Id = :user_I

I knew that just not what boz showed me thank you tho!
For duckets the currency is 0, the credits are stored in the uses table. Use this to get duckets currency, change accordingly for your currency needed.
PHP:
<?php
                        $users_a = mysql_query("SELECT * FROM users INNER JOIN users_currency ON users.id=users_currency.user_id AND users_currency.type = '0' WHERE `rank` <= '8' ORDER BY users_currency.amount DESC LIMIT 5");
                        while($users = mysql_fetch_assoc($users_a)){
                            $row = mysql_fetch_assoc($row = mysql_query("SELECT * FROM users WHERE id = '".$users['id']."' LIMIT 5"));
                        ?>
P.S that’s a code for leaderboards.
game changer always thank you mate!
 

Users who are viewing this thread

Top