简体   繁体   中英

How would I echo a specific table on a database?

So I am trying to echo a user's amount of money they have made, but it is not working. I am using this code but it is showing all of the users payout. How would I show the user his payout and not others?

<?php $user_details = $db->select("SELECT * FROM 'as_user_details'");
foreach ( $user_details as $row ) {
    echo $row['payout']; 
} ?>

Only fetch the data of that particular user from the dB rather fetching data for all the users.

<?php 
    $user_details = $db->select("SELECT * FROM 'as_user_details' where id = '$user_id' ");
    echo $user_details['payout']; 
?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM