bateman Posted September 14, 2009 Share Posted September 14, 2009 alright, so I'm trying to pull data from 2 tables to create a list. I'm successful in phpmyadmin but it won't pull when I try from php. Here is the code I'm using $query2 = mysql_query("SELECT * FROM photog, shoot WHERE photog.actual=shoot.photog ORDER BY id Asc"); ... ... $x = 1; while ($list = mysql_fetch_assoc($query2)) { $photog = $list['photographer']; $link = $list['actual']; $picid = $list['image'];$shoot = $list['shoot']; $num = $list['num']; // echo data ?> <?=$photog;?><br><a href="model/index.php?p=<?=$link;?>&s=<?=$num;?>&i=1" ><?=$shoot;?></a><? echo ($x)? "<br><br>" : ""; $x++; } // end while Any help would be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/174231-solved-dueling-tables-on-join/ Share on other sites More sharing options...
rhodesa Posted September 14, 2009 Share Posted September 14, 2009 what do you mean by "it won't pull when I try from php"? no rows are returned? are you sure you are connected to the right database? try updating this line: $query2 = mysql_query("SELECT * FROM photog, shoot WHERE photog.actual=shoot.photog ORDER BY id Asc") or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/174231-solved-dueling-tables-on-join/#findComment-918470 Share on other sites More sharing options...
bateman Posted September 14, 2009 Author Share Posted September 14, 2009 It is pulling from the database, I just didn't include that here. after inserting the or die it came back with Column 'id' in order clause is ambiguous Quote Link to comment https://forums.phpfreaks.com/topic/174231-solved-dueling-tables-on-join/#findComment-918473 Share on other sites More sharing options...
bateman Posted September 14, 2009 Author Share Posted September 14, 2009 ok, I figured it out. Thank you. that ID sort was kinda missed the first 10^8 times Quote Link to comment https://forums.phpfreaks.com/topic/174231-solved-dueling-tables-on-join/#findComment-918478 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.