Jump to content

Help with Pulling Information from Database


aweb

Recommended Posts

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!

 

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.