Jacko623 Posted February 18, 2007 Share Posted February 18, 2007 Hi everyone, I hired some guys to create a site for me, and they did a shoddy job. Right now, I have one table that displays a bar name, details, a city. The city in the first table is a number, which responds to an integer in a second table which corresponds to a specific text. For example Bar_Details: Bar: The Rock Bottom Town: 1 Description: Blah blah blah City_Details: ID: 1 Town: New York City Here is the script (which returns NO errors): $ConDB=mysql_connect($hostname,$username,$password); $DB=mysql_select_db($dbname,$ConDB); [color=blue]//Query Information [/color] $query = "SELECT bar_name,bar_descrip,city FROM partynj_bar_details ORDER by Rand() limit 0,1"; $result = mysql_query($query); [color=blue]//print information [/color] while(list($bar_name,$bar_descrip) = mysql_fetch_array($result)) { ?> <a href="../bars/?<?=stripslashes($bar_name)."|".$id?>&act=all"><?=stripslashes($bar_name)?></a><br> <? echo stripslashes("Name : $bar_name <br>"); echo stripslashes("Description : $bar_descrip <br><br>"); } [color=blue]//Troublesome area[/color] $query2 = "SELECT city FROM partynj_citylist WHERE id='$city'"; $result2 = mysql_query($query2); [color=blue]//print information[/color] echo stripslashes($bar_name)?> is located in <?=stripslashes($results2); ?> Now, everything works fine, up to the //troublesome remark. When I generate the page the first part generates a random bar, a link, the title and the description. The second part should display the what town the bar is located in, but instead only returns "is located in". There are no errors. What do you think? Quote Link to comment Share on other sites More sharing options...
Imtehbegginer Posted February 18, 2007 Share Posted February 18, 2007 Remove the numbers from $query2 and $result2, make them $resultwo, or $querytwo Quote Link to comment Share on other sites More sharing options...
Jacko623 Posted February 18, 2007 Author Share Posted February 18, 2007 Same response... I really don't understand why this is happening. I performed the query in myPHP and it returned the city text. It has something to do with the echo function I believe, but I cannot figure out for the life of me. Quote Link to comment 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.