Jump to content

Variables


dachshund

Recommended Posts

Hi,

 

I have a website with various 'Venues' on it, ie. Art galleries, music venues etc. On the same site I have a list of events. Both of these draw their info from a mysql database.

 

Does anyone know how i can list the events of a user selected venue on the page. I.e. When someone looks at the Tate Modern, the events currently at the Tate will be listed down the side.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/105674-variables/
Share on other sites

Hi, yeah I tried that, still trying to get it to work, any idea why this code is wrong?

			<table width="500" border="0" align="left" cellpadding="5">

<?php
$id=$_GET['id'];

$sql="SELECT * FROM venues WHERE id='$id'";
$result=mysql_query($sql);
while($rows=mysql_fetch_array($result)){
?>

				<tr>
                    	<td width="50%" align="left" valign="top" class="smallertitle">
                        	<? echo $rows['title']; ?>
                        </td>
                        <td width="50%" align="right" valign="top" class="condensedeventcontent">
                        	<? echo $rows['type']; ?>
                        </td>
                    </tr>
                    <tr>
                    	<td width="100%" align="left" valign="top" colspan="2">
                        	<img src="<? echo $rows['largeimage']; ?>" />
                        </td>
                    </tr>
                    <tr>
                    	<td width="100%" align="justify" valign="top" colspan="2" class="maincontent">
                        	<? echo $rows['description']; ?>
                        </td>
                    </tr>
                    <tr>
                    	<td width="100%" align="left" valign="top" class="eventaddressdate">
                        	<? echo $rows['address1'];	?>
                            <br />
                            <? echo $rows['address2']; ?>
                            <br />
                            <? echo $rows['city']; ?>
                            <br />
                            <? echo $rows['postcode']; ?>
                        </td>
                    </tr>
                    <tr>
                    <td width="100%" colspan="2" align="left" valign="bottom" class="wordsby">
                    	<a href ="<? echo $rows['webaddress']; ?>"><? echo $rows['webaddress']; ?></a>
				</td>
                    </tr>
                            
                            
<?php
}
mysql_close();
?>
</table>




		</td>
            <td>
            <table border="0" align="left" cellpadding="5">
			<?php
			$title=$_GET['title'];
			$samevenue="SELECT * FROM events WHERE venue='$title'";
			$result2=mysql_query($samevenue);
			while($rows2=mysql_fetch_array($result2)){
			?>
                <tr>
                    	<td width="50%" align="left" valign="top" class="smallertitle">
                        	<? echo $rows2; ?>
                        </td>
                </tr>
                		<?php
					}
					mysql_close();
					?>
</table>

 

The address bar contains the id and title of the venue, and the venue name and title always match up in the databases. Is it something to do with the mysql_close? It all displays fine up until the first mysql_close.

 

Thanks

 

 

Link to comment
https://forums.phpfreaks.com/topic/105674-variables/#findComment-541492
Share on other sites

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.