seany123 Posted September 11, 2008 Share Posted September 11, 2008 Okay so im making a Text based game, but ive come to a big of a problem.. in my private_header i have a toolbar like table which works like a navagator, I want one of the cells to display the current city he player is in and have a link to that cities page.. In my database i have two tables for this to work, one table is called 'Players' and it contains 'city_id'... and another table is called 'city' and it contains 'city_id' and 'city_name. ive tried $city = $db->execute("select `city_name`, city_id from `city` where `city_id` like '$players->city_id'"): echo("$city->city_name"); but it didnt work.. ive also tried... <?php $query = $db->execute("select * from `city` where `id` like '$player->city_id'"); $city = $query->fetchrow(); echo "<a href = 'city.php?id= " . $city['id'] . ">" . $city['name'] . "</a>"; ?> but it just came up with a error which i didnt copy... I need help if anyone is able to do this code. This is the page im wanting to get it into.... <html> <head> <title>ezRPG :: <?=PAGENAME?></title> <link rel="stylesheet" type="text/css" href="./templates/style.css" /> <style type="text/css"> <!-- .style1 {color: #CCCCCC; font-weight: bold; } .style4 {font-weight: bold; color: #FFFFFF; } body { background-color: #000000; } .style6 { color: #FFFFFF; font-family: Arial; } body,td,th { color: #FFFFFF; } a:link { color: #FF0000; } a:visited { color: #FF0000; } a:hover { color: #666666; } a:active { color: #FF0000; } .style8 {color: #FFFFFF} --> </style> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head> <body> <div id="wrapper"> <div class="style6 style6 style6" id="header"> <table width="935" height="71" border="0" bordercolor="#000000" bgcolor="#000000"> <tr> <td width="1" bgcolor="#000000"> </td> <td width="419" bordercolor="#000000" bgcolor="#000000"><img src="http://images.cooltext.com/142744.gif" alt="Mafiakiller" width="419" height="129" border="0" /><br /></td> <td colspan="3" bordercolor="#000000" bgcolor="#000000"><table width="500" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="4" colspan="10" class="style8"></td> </tr> <tr> <td width="14" bgcolor="#000000" class="style8"></td> <td width="54" height="20" bgcolor="#000000" class="style4">User</td> <td width="14" bgcolor="#000000" class="style8"></td> <td height="20" colspan="2" bgcolor="#000000" class="style8"><?=$player->username?></td> <td width="10" bgcolor="#000000" class="style8"></td> <td width="50" height="20" bgcolor="#000000" class="style4">HP</td> <td width="10" bgcolor="#000000" class="style8"></td> <td width="100" height="20" align="left" valign="middle" bgcolor="#000000" class="style8"><img src="bargen.php?hp" alt="hp"></td> <td width="10" bgcolor="#000000" class="style8"></td> </tr> <tr> <td height="4" colspan="10" bgcolor="#000000" class="style8"></td> </tr> <tr> <td width="14" bgcolor="#000000" class="style8"></td> <td width="54" height="20" bgcolor="#000000" class="style4">Level</td> <td width="14" bgcolor="#000000" class="style8"></td> <td height="20" colspan="2" bgcolor="#000000" class="style8"><?=$player->level?></td> <td width="10" bgcolor="#000000" class="style8"></td> <td width="50" height="20" bgcolor="#000000" class="style4">Energy</td> <td width="10" bgcolor="#000000" class="style8"></td> <td width="100" height="20" align="left" valign="middle" bgcolor="#000000" class="style8"><img src="bargen.php?energy" alt="energy"></td> <td width="10" bgcolor="#000000" class="style8"></td> </tr> <tr> <td height="4" colspan="10" bgcolor="#000000" class="style8"></td> </tr> <tr> <td width="14" bgcolor="#000000" class="style8"></td> <td width="54" height="20" bgcolor="#000000" class="style4">Money</td> <td width="14" bgcolor="#000000" class="style8"></td> <td height="20" colspan="2" bgcolor="#000000" class="style8"><b> $<?=$player->money?></b> [<a href="bank.php?auto=1">deposit</a>]</td> <td width="10" bgcolor="#000000" class="style8"></td> <td width="50" height="20" bgcolor="#000000" class="style4">Awake</td> <td width="10" bgcolor="#000000" class="style8"></td> <td width="100" height="20" align="left" valign="middle" bgcolor="#000000" class="style8"><img src="bargen.php?awake"></td> <td width="10" bgcolor="#000000" class="style8"></td> </tr> <tr> <td height="4" colspan="10" bgcolor="#000000" class="style8"></td> </tr> <tr> <td width="14" bgcolor="#000000" class="style8"></td> <td width="54" height="20" bgcolor="#000000" class="style4">Balance</td> <td width="14" bgcolor="#000000" class="style8"></td> <td height="20" colspan="2" bgcolor="#000000" class="style8"><b>$<?=$player->bank?> </b></td> <td width="10" bgcolor="#000000" class="style8"></td> <td width="50" height="20" bgcolor="#000000" class="style4">Nerve</td> <td width="10" bgcolor="#000000" class="style8"></td> <td width="100" height="20" align="left" valign="middle" bgcolor="#000000" class="style8"><img src="bargen.php?nerve"></td> <td width="10" bgcolor="#000000" class="style8"></td> </tr> <tr> <td height="4" colspan="10" bgcolor="#000000" class="style8"></td> </tr> <tr> <td width="14" bgcolor="#000000" class="style8"></td> <td width="54" height="20" bgcolor="#000000" class="style4">Points</td> <td width="14" bgcolor="#000000" class="style8"></td> <td width="32" height="20" bgcolor="#000000" class="style8"><i> <?=$player->points?></i></td> <td width="206" bgcolor="#000000" class="style8">[<a href="refill.php">use</a>] [<a href="upgrade.php">buy</a>]</td> <td width="10" bgcolor="#000000" class="style8"></td> <td width="50" height="20" bgcolor="#000000" class="style4"> </td> <td width="10" bgcolor="#000000" class="style8"></td> <td width="100" height="20" align="left" valign="middle" bgcolor="#000000" class="style8"> </td> <td width="10" bgcolor="#000000" class="style8"></td> </tr> <tr> <td height="4" colspan="10" class="style8"></td> </tr> </table></td> </tr> <tr> <td bgcolor="#000000"> </td> <td bordercolor="#000000" bgcolor="#000000"> </td> <td width="287" bordercolor="#000000" bgcolor="#000000"> </td> <td width="68" bordercolor="#FFFFFF" bgcolor="#000000"><a href="vote.php">Vote</a></td> <td width="133" bordercolor="#FFFFFF" bgcolor="#000000">Upgrade Account </td> </tr> </table> </div> <div class="style6 style6 style6" id="left"> <div class="left-section"> <table width="140" border="1" align="right" cellpadding="1" cellspacing="1" bordercolor="#FF0000" bgcolor="#000000"> <tr> <td width="140" align="center" valign="middle" bordercolor="#FF0000" bgcolor="#333333"><span class="style4">Menu</span></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="home.php" width="140">Home</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="inventory.php">Inventory</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="london.php">London</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="bank.php">Bank</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="gym.php">Gym</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="crime.php">Crime</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><b>Gang: [</b><a href="guild_home.php"><?=$player->guild?></a><b>]</b></a><br> </a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="mailbox.php">Mail Box [0]</a></td> </tr> <tr> <td width=140 align=left valign=middle bordercolor=#333333 bgcolor=#000000 onmouseover=this.className='highlight' onmouseout=this.className='normal'><a href=gangmail.php>Gang Mail [0]</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="events.php">Events [<span class=style1>2</span>]</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="prison.php">Prison [0]</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="medical_ward.php">Hospital</a> []</td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="vets.php">Vets [<span class=style1>20</span>]</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="pound.php">Dog Pound [0]</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="spylogs.php">Spy Logs</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="yourcars.php">Your Cars</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="yourpets.php">Your Pets</a></td> </tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="levelhof.php">Hall Of Fame</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="notepad.php">Note Pad</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="search.php">Search</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="chatroom.php">Chat Room</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="forum.php">Forum</a></td> </tr> <tr> <td width="140" align="center" valign="middle" bordercolor="#FF0000" bgcolor="#333333" class="style4">Support</td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="supportdesk.php">Support Desk</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#000000" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="bbcode.php">BBCode Help</a></td> </tr> <tr> <td width="140" align="center" valign="middle" bordercolor="#FF0000" bgcolor="#333333" class="style4">Account</td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="editaccount.php">Edit Account</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="contactlist.php">Contact List</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="manageignores.php">Manage Ignores</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="upgrade.php">Upgrade</a></td> </tr> <tr> <td width="140" align="left" valign="middle" bordercolor="#333333" bgcolor="#000000" onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'"><a href="logout.php">Logout</a></td> </tr> </table> <p class="style8"> </p> </div> </div> in the palce of where is says 'london' thanks Quote Link to comment Share on other sites More sharing options...
Brian W Posted September 11, 2008 Share Posted September 11, 2008 What have you done so far for trouble shooting? Have you echoed your players.city_id to be sure it is coming up with what you need? I think it would really help if you could provide the error message for us. 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.