Jump to content

[SOLVED] What's wrong with this code?


dachshund

Recommended Posts

			<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 it's getting info from looks like: /view_venue.php?id=12?title=Fieldgate%20Gallery

 

And the 'title' and 'venue' are always the same.

 

Help?

Link to comment
https://forums.phpfreaks.com/topic/105781-solved-whats-wrong-with-this-code/
Share on other sites

Sorry, the problem is the second part:

            <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['title']; ?>
                        </td>
                </tr>
                		<?php
					}
					mysql_close();
					?>
</table>

 

Doesn't display any results.

 

I've changed it to &title= now, but still no luck...

 

 

try using some debugging

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

 

Ray

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.