Hey guys. I'm getting back into PHP after about a year or two of a little hiatus and I need some help getting back into it. I am currently working on some old coding before I upgrade (will be learning that shortly), but I need some help joining these two tables so I can output the data I want to. Here's the basic premisis:
Table 1: (defects table)
id (#'s)
defect (text)
Table 2: (character defects table)
id (#'s)
identity (links the defects with the character)
defect (matches the id from the previous table)
desc (additional info about the defect for that particular character)
Here's the code I have so far:
//gather the defects
$get_defects = "select * from defects";
$get_defects_res = mysql_query($get_defects, $conn) or die(mysql_error());
while ($defects_info = mysql_fetch_array($get_defects_res)) {
$defects_id = $defects_info['id'];
$defects = $defects_info['defect'];
}
//gather the character defects
$get_character_defects = "select * from character_defects where identity = 'Sailor Moon'";
$get_character_defects_res = mysql_query($get_character_defects, $conn) or die(mysql_error());
$display_block .= "<table width=40% cellpadding=3 cellspacing=1 border=0>";
while ($character_defects_info = mysql_fetch_array($get_character_defects_res)) {
$character_defects = $character_defects_info['defect'];
$defect_desc = $character_defects_info['desc'];
$character_defect =
}
So I have gathered all the defects and their respective id's, then gathered all the character defects where the identity is equal to a character (later this will be based on the logged in person and their selected character). So now I am stuck. I want to list all the defects this particular character has, plus the respective descriptions if they exist, but I don't know how to write the next part that connects them together. I'm thinking I need to JOIN them, but I'm kind of at a loss. I know, I know, I know...I should be using updated PHP. I haven't learned it yet and I'm waiting for a book to come in the mail for me to start learning, and then I will update it. My current server is running the old versions for now since this is what I know how to use and have examples to work with :-( Can anyone help me on this please? :-) It's very simple so far. I have the link if anyone needs it, although I doubt it will be as useful as the actual code I've listed above and the tables.