Hello,
I have been driving myself crazy trying to figure out what I think should be a simple thing to do.
I have two tables - one named HOBBIE_TYPES, the other named MY_HOBBIES. The HOBBIE_TYPES table contains records listing a wide variety of different hobbies. This table is used with a PHP script to dynamically generate a drop down menu on a form that users can use to select and specify their favorite hobbies. Once they do so, their selection is added to the MY_HOBBIES table.
However, if a user decides to add more hobbies to their profile, I want the drop down list to exclude any hobbies that they have already added in the MY_HOBBIES table.
The code that I am using is as follows, and it is not doing what I want:
// Query the HOBBIE_TYPES and MY_HOBBIES tables to dynamically generate hobby list
$hobby_query = mysql_query("SELECT
HOBBIE_TYPES.hobby_ID,
HOBBIE_TYPES.hobby_name
FROM HOBBIE_TYPES, MY_HOBBIES
WHERE HOBBIES.hobby_ID != MY_HOBBIES.hobby_ID
AND MY_HOBBIES.username = '$username'
ORDER BY HOBBIES_TYPES.display_name");
$hobby_result = mysql_num_rows($hobby_query);
I have been referencing various sites and manuals, but I am still unable to figure out what I am overlooking, and I know that this type of thing has to be possible.
revez2002