database question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
robynprivette
Forum Commoner
Posts: 46
Joined: Sun May 02, 2010 6:22 pm

database question

Post by robynprivette »

So I have three tables....

egg
hatch
er

let's use table egg as an example

in the table egg there are 2 columns, user and code

What code do I use to get all the code entries from one user?
User avatar
flying_circus
Forum Regular
Posts: 732
Joined: Wed Mar 05, 2008 10:23 pm
Location: Sunriver, OR

Re: database question

Post by flying_circus »

robynprivette wrote:So I have three tables....

egg
hatch
er

let's use table egg as an example

in the table egg there are 2 columns, user and code

What code do I use to get all the code entries from one user?
$user = mysql_real_escape_string($user);
SELECT `code` FROM `egg` WHERE `user`=$user;
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: database question

Post by califdon »

Your question isn't very specific, but I would say you need to read some basic tutorials on relational database theory. I recommend the following:
http://www.surfermall.com/relational/lesson_1.htm
http://www.kirupa.com/developer/php/rel ... design.htm
http://www.geekgirls.com/databases_from_scratch_3.htm
http://www.tekstenuitleg.net/en/article ... stics.html
Post Reply