Jump to content

Recommended Posts

Hello...

 

I'm retrieving info from a DB and would like to echo the name of the fields that the info comes from. I've got no prob with the info from the fields themselves, but if I want to say what is the field the info is coming from, I'm lost.

 

I've got a table with all the users in it. I can query to see how much money they have, but some have and some don't, so i only want to print those who have got some value in the field, and name them...

 

let's say

 

Jhon | Mary | Lucy | Robert

200  | 120  |        | 50

 

I can get 200, 120, and 50... but how do you go about getting the names and associate them with the amount?

 

thanks!

 

Link to comment
https://forums.phpfreaks.com/topic/55950-printing-the-field-names-too/
Share on other sites

I changed the table to what I was advised to in the forum a few days ago, cause I used to have a table for each user in order to retrieve info easily from individual users...

 

it's a snnoker players table!

 

I've got all of the player in it them there...

when a user is registerd, he goes into a table of users... I write there his nick, his pass, and i'ts assigned some money, and the field for each of the top 20 snooker players in the world.. so that they can buy and sell "stocks" and increase or decrease the number of stocks the have... I would like to show something like: "My Stocks" and print let's say...

 

User Stocks

 

Player |   Stocks

Ronnie O'Sullivan | 5

Steve Davis  | 0

Graeme Dott | 6

John Higgins  | 2

 

so I know how to get the values 5, 0, 6, 2... but I want to print also the names of the players, only if the numbers of stocks are > 0... so I need to get an array from the users table with the pair name of player, number of stocks...

 

you can see the web at snookermarket

thank for your reply

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.