chrischen Posted February 18, 2008 Share Posted February 18, 2008 This is my query $query_new = sprintf("SELECT table1.text, table1.text2, table1.mid, table1.id, merch.id, merch.name, table1.expire FROM table1 INNER JOIN merch ON merch.mid = table1.mid WHERE table1.status = 'Y' AND table1.linkType = %s ORDER BY table1.$col $sort", GetSQLValueString("Text Link", "text")); But when I echo $row_new['table1.id'] it outputs nothing however if I echo $row_new['id'] it gives me the value of merch.id. I need to be able to echo table1.id and merch.id. How do I do this? Quote Link to comment Share on other sites More sharing options...
aunquarra Posted February 18, 2008 Share Posted February 18, 2008 The safest bet to avoid overwriting stuff like this is to use "AS" statements, like... SELECT table1.text, table1.text2, table1.mid, table1.id AS table1id, merch.id as merchid, merch.name, table1.expire FROM table1 INNER JOIN merch ON merch.mid = table1.mid WHERE table1.status = 'Y' AND table1.linkType = %s ORDER BY table1.$col $sort Quote Link to comment Share on other sites More sharing options...
chrischen Posted February 18, 2008 Author Share Posted February 18, 2008 thanks it worked! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.