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!

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.