dachshund Posted May 15, 2008 Share Posted May 15, 2008 <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? Quote Link to comment https://forums.phpfreaks.com/topic/105781-solved-whats-wrong-with-this-code/ Share on other sites More sharing options...
revraz Posted May 15, 2008 Share Posted May 15, 2008 You don't say what the actual problem is. Quote Link to comment https://forums.phpfreaks.com/topic/105781-solved-whats-wrong-with-this-code/#findComment-542074 Share on other sites More sharing options...
craygo Posted May 15, 2008 Share Posted May 15, 2008 this link doesn't look right /view_venue.php?id=12?title=Fieldgate%20Gallery should be /view_venue.php?id=12&title=Fieldgate%20Gallery Fix your link and let us know Ray Quote Link to comment https://forums.phpfreaks.com/topic/105781-solved-whats-wrong-with-this-code/#findComment-542078 Share on other sites More sharing options...
dachshund Posted May 15, 2008 Author Share Posted May 15, 2008 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... Quote Link to comment https://forums.phpfreaks.com/topic/105781-solved-whats-wrong-with-this-code/#findComment-542084 Share on other sites More sharing options...
benphp Posted May 15, 2008 Share Posted May 15, 2008 The address is wrong in the database. It isn't wrong in this code. Quote Link to comment https://forums.phpfreaks.com/topic/105781-solved-whats-wrong-with-this-code/#findComment-542087 Share on other sites More sharing options...
craygo Posted May 15, 2008 Share Posted May 15, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/105781-solved-whats-wrong-with-this-code/#findComment-542093 Share on other sites More sharing options...
revraz Posted May 15, 2008 Share Posted May 15, 2008 Also, try to use full tags instead of short ones, maybe they are turned off <?php echo $rows2['title']; ?> Quote Link to comment https://forums.phpfreaks.com/topic/105781-solved-whats-wrong-with-this-code/#findComment-542099 Share on other sites More sharing options...
dachshund Posted May 15, 2008 Author Share Posted May 15, 2008 I tried the debugging and it comes up with: Fieldgate GalleryCan't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) But I can't work out why. Quote Link to comment https://forums.phpfreaks.com/topic/105781-solved-whats-wrong-with-this-code/#findComment-542106 Share on other sites More sharing options...
craygo Posted May 15, 2008 Share Posted May 15, 2008 That's because you closed your connection before you ran your second query. move mysql_close to the very end. Ray Quote Link to comment https://forums.phpfreaks.com/topic/105781-solved-whats-wrong-with-this-code/#findComment-542108 Share on other sites More sharing options...
dachshund Posted May 15, 2008 Author Share Posted May 15, 2008 Thanks Ray, that worked Quote Link to comment https://forums.phpfreaks.com/topic/105781-solved-whats-wrong-with-this-code/#findComment-542111 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.