prays Posted March 26, 2008 Share Posted March 26, 2008 Hi all, I have these tables Lead_click ---------- id lid click username Lead_info --------- id lid description img url price Lead_sub -------- id lid username How do I list the leads where click is greater than 0, in one row, where Lead_info provides the information such as description, and Lead_sub shows how many people has subscribed, and only for the username "x" for instance. I hope you understand me. Thanks! Link to comment https://forums.phpfreaks.com/topic/98057-two-tables-one-result/ Share on other sites More sharing options...
p2grace Posted March 26, 2008 Share Posted March 26, 2008 Is this what you're looking for? <?php $query = "SELECT `c`.`click`, `i`.`description`, `s`.`lid` FROM `Lead_click` c, `Lead_info` i, `Lead_Sub` s WHERE `c`.`username` = '$username' AND `i`.`username` = '$username' AND `s`.`username` = '$username'"; $run = mysql_query($query); ?> I'm not sure if I understood your question, but this would be a way of returning data from the three tables. Link to comment https://forums.phpfreaks.com/topic/98057-two-tables-one-result/#findComment-501714 Share on other sites More sharing options...
prays Posted March 26, 2008 Author Share Posted March 26, 2008 I didn't really work. But i'll try to ask in another way. From the three tables i need to write this: Description(lead_info) - Clicks(lead_click) - Leads(Number of rows in lead_sub where username=$username) And this should be shown if click in lead_click is greater than 0, for the username, $username. I hope this helped, and i'm sorry, but i have a real hard time explaining this. Link to comment https://forums.phpfreaks.com/topic/98057-two-tables-one-result/#findComment-501739 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.