MySQL & PHP: Search until data avaliable?

Damir&Martina

New member
I'm learning php and mysql. I began with the basics and I think I know a few things now (here and there) :)))

I need some help:

table "example"
----------------------------------------------------
id | name | friends | salary
----------------------------------------------------
0 | john | pete | 10k
1 | ross | john | NO DATA
2 | mike | ross | NO DATA
3 | sam | mike | NO DATA
4 | bob | mike | 10k
5 | tim | bob | 10k


I want to print out specific data.
Example:
Im Bob and I make 10k.
My friend mike does not work so Im looking for his friend. (because he has no data)
Ross also does not work (no data) so Im looking for his friend.
Util I find someone who does work.
I want to print his data
In this case "John".

John makes 10k monthly.

I have no idea where to start. How to go trought db until I find a hit.

------------------------------
connect to db

if ( mikes sallary = "NO DATA" )[{
go trought db util hit (HEEEEEEEELP)
}


I tried google-ing it, but its been 2 hours now I would appreciate some help, any help, hint, something...
 
Back
Top