[PHP] echo diferent coluns from left join
Dear List, I have this sql command that grabs a result of 3 tables. What i want is if there's a way to do a while printing the site and url and after it's finish begin, printing site_2 and url_2. SELECT celebridades.*, links_relacionados.Nome_Link as site,links_relacionados.Url_link as url, fanclubes.Nome as site_2,fanclubes.Site as url_2 FROM celebridades LEFT JOIN links_relacionados ON links_relacionados.CelebID=celebridades.CelebID LEFT JOIN fanclubes ON fanclubes.CelebID=celebridades.CelebID WHERE celebridades.CelebID='$celebID' Thank's in advance Rodrigo Peres -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] echo diferent coluns from left join
If I understand you correctly, use Javascript to open a second browser window for url_2. Miles Thompson At 02:49 PM 1/10/2002 -0200, Rodrigo Peres wrote: Dear List, I have this sql command that grabs a result of 3 tables. What i want is if there's a way to do a while printing the site and url and after it's finish begin, printing site_2 and url_2. SELECT celebridades.*, links_relacionados.Nome_Link as site,links_relacionados.Url_link as url, fanclubes.Nome as site_2,fanclubes.Site as url_2 FROM celebridades LEFT JOIN links_relacionados ON links_relacionados.CelebID=celebridades.CelebID LEFT JOIN fanclubes ON fanclubes.CelebID=celebridades.CelebID WHERE celebridades.CelebID='$celebID' Thank's in advance Rodrigo Peres -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] echo diferent coluns from left join
Sorry, Ithink that I not explain right. I nedd to create a list, something like: url site br url site br url_2 site_2 br url_2 site_2 br When the values returned by url and site finished them proceed to url_2 and site_2 values. Thank's Rodrigo on 1/10/02 3:16 PM, Miles Thompson at [EMAIL PROTECTED] wrote: If I understand you correctly, use Javascript to open a second browser window for url_2. Miles Thompson At 02:49 PM 1/10/2002 -0200, Rodrigo Peres wrote: Dear List, I have this sql command that grabs a result of 3 tables. What i want is if there's a way to do a while printing the site and url and after it's finish begin, printing site_2 and url_2. SELECT celebridades.*, links_relacionados.Nome_Link as site,links_relacionados.Url_link as url, fanclubes.Nome as site_2,fanclubes.Site as url_2 FROM celebridades LEFT JOIN links_relacionados ON links_relacionados.CelebID=celebridades.CelebID LEFT JOIN fanclubes ON fanclubes.CelebID=celebridades.CelebID WHERE celebridades.CelebID='$celebID' Thank's in advance Rodrigo Peres -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] echo diferent coluns from left join
Two ways actually ... You could execute two separate SQL statements, and process them one after another. or You could process your result set, echo()'ing or print()'ing the first elements of the result set, then go back to the beginning and do the second set, something like this ... for ($i = 1; $i = 2; $i++) { while( $row = mysql_fetch_array($result) ) { echo $row[ $i ] . br; } mysql_data_seek( $result, 0 ); } Better double check the index of the $row array as I may be returning the field name here, maybe it should be $row[ $i+1], but I think you get the idea. Miles Thompson At 04:08 PM 1/10/2002 -0200, Rodrigo Peres wrote: Sorry, Ithink that I not explain right. I nedd to create a list, something like: url site br url site br url_2 site_2 br url_2 site_2 br When the values returned by url and site finished them proceed to url_2 and site_2 values. Thank's Rodrigo on 1/10/02 3:16 PM, Miles Thompson at [EMAIL PROTECTED] wrote: If I understand you correctly, use Javascript to open a second browser window for url_2. Miles Thompson At 02:49 PM 1/10/2002 -0200, Rodrigo Peres wrote: Dear List, I have this sql command that grabs a result of 3 tables. What i want is if there's a way to do a while printing the site and url and after it's finish begin, printing site_2 and url_2. SELECT celebridades.*, links_relacionados.Nome_Link as site,links_relacionados.Url_link as url, fanclubes.Nome as site_2,fanclubes.Site as url_2 FROM celebridades LEFT JOIN links_relacionados ON links_relacionados.CelebID=celebridades.CelebID LEFT JOIN fanclubes ON fanclubes.CelebID=celebridades.CelebID WHERE celebridades.CelebID='$celebID' Thank's in advance Rodrigo Peres -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]