aweb Posted November 7, 2009 Share Posted November 7, 2009 I have a page on my site that I need to pull data from two different tables. For some reason I can't get this to work together, but I can get it to work separately so it must be something wrong with the way I am coding it. Any help would be appreciated! Here is what I am doing now: At the top of the page I have: $id=$_REQUEST['id']; Later on I pull the first set of information like so: <? $selectevent=mysql_query("select * from ExampleTable1_tbl where ExampleTable1_Status=1"); if(mysql_num_rows($selectevent)>0) { while($rsevent=mysql_fetch_assoc($selectevent)) { ?> <? echo $rsevent['ExampleTable1_Name'];?> ... etc.... For the second set of information: <? $selectevent=mysql_query("select * from ExampleTable2_tbl where ExampleTable2=1 order by Event_Startdate"); if(mysql_num_rows($selectevent)>0) { while($rsevent=mysql_fetch_assoc($selectevent)) { ?> <? echo $rsevent['Event_Name'];?> ....etc... Like I said when I pull information from just one of the tables, either/or, everything works great. But when I try to pull both I get php errors. Thanks! Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted November 7, 2009 Share Posted November 7, 2009 how does your code look when you try to pull both the tables together ? Quote Link to comment Share on other sites More sharing options...
xtopolis Posted November 7, 2009 Share Posted November 7, 2009 Better yet, what are the errors... Quote Link to comment Share on other sites More sharing options...
aweb Posted November 7, 2009 Author Share Posted November 7, 2009 The code I showed previously is how it looks when I try to pull them both. And the error I get is: Parse error: syntax error, unexpected $end... Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted November 7, 2009 Share Posted November 7, 2009 that mostly comes when you miss out to close a control structure... Quote Link to comment Share on other sites More sharing options...
xtopolis Posted November 7, 2009 Share Posted November 7, 2009 You're leaving a lot of information out. I think it would be best to post the full code of your attempt to display both tables. Also, it's a best practice to use full tags <?php ?> instead of short tags <? ?>; you should probably change yours. 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.