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. 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()); 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 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 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
Archived
This topic is now archived and is closed to further replies.