my name is brad and i'm very new to this forum. i am also new to web development, so please excuse me if i use the incorrect terminology as i'm still learning. i am stuck on a problem and i'm pretty sure it has to do with the SQL that i'm using (... incorrectly). i have two tables that are relevant (i will list their contents below). i have a profile page set up for my users and there are two sections in particular that i'm concerned about with this query; "my buy list" and "my sell list." i currently have the page only accessible if the user is logged in, so it is strictly tied to a session variable (which i have a separate sql set up for... i'll list that too). i would like the user to have their posts to buy and share, if any, to be placed in the appropriate place on their profile page. for the posts that do show up on the users profile, i would like it to appear as the post_title and post_date.
i have my tables below and the current sql statement. i'm not sure if everything can somehow go in one sql statement or if i need more, but i'm definitely confused at this point.
any help would be greatly appreciated, thank you!
userTable: user_id, username, email, password, register_date, fun_fact
postingTable: post_id, user_id, post_title, post_date, product_name, category_name(ENUM), store_name, buy_or_share(ENUM)
current SQL (i deleted the many different WHERE clauses that i've tried to spare anyone the headache of my mistakes...)
SELECT user_id, username, register_date, email, fun_fact, DATE_FORMAT(register_date, '%b %e, %Y') AS us_format, userTable.post_id, postingTable.post_id, postingTable.post_title, postingTable.product_name, postingTable.post_date, postingTable.buy_or_share, postingTable.category_name, postingTable.store_name
FROM userTable, postingTable
WHERE username = colname (the colname is where i get the session variable, it is set to text, default -1, run-time value is $_SESSION['MM_Username'].
any recommendations, advice, help, etc. will make me better off than where i am now, thank you for the help!!
This post has been edited by email@example.com: 11 February 2009 - 11:46 AM