AndrewVlcek Posted August 2, 2008 Share Posted August 2, 2008 I am trying to add new code to my site and I am having some troubles. I am very new to PHP. I have this code which works ok: <? if($index == yes){ echo" <div class='maincontentbg'> <table width=\"600\" border=\"0\" cellspacing=\"2\" cellpadding=\"1\"> <tr> <td>Latest Free Agents</td> <td>Spolight Profile</td> </tr> </table> </div>"; } ?> Where it says Latest Free Agents I want this script in that table cell: <div class="bottomrighsidebar"></div> <div class="toprighsidebartitle">Latest Free Agents</div> <div class="toprighsidebarbg"><table width="90%" align="center" bgcolor="#000000" cellspacing="1"> <? $latestagents=mysql_query("SELECT freeagents.id, gamename, game FROM freeagents LEFT JOIN ladders ON freeagents.ladder = ladders.id ORDER BY freeagents.id DESC LIMIT 0,6"); while(list($freeagentsuser,$freeagentsgamename,$laddersgame)=mysql_fetch_row($latestagents)){ if($config[cellbgx]==$config[cellbg]){$config[cellbgx]="$config[cellbg2]";}else{$config[cellbgx]="$config[cellbg]";} echo"<tr bgcolor='$config[altcolora]'><td background='$config[cellbgx]'><a href='./freeagents.php?action=viewagent&agent=$freeagentsuser'><span style='color:#FFFFFF;'>$freeagentsgamename <br> $laddersgame</span></a><br /><br /></td></tr>"; } ?></table> </div> How do I merge those 2 scripts? Thanks, Andrew Quote Link to comment https://forums.phpfreaks.com/topic/117856-need-help/ Share on other sites More sharing options...
genericnumber1 Posted August 2, 2008 Share Posted August 2, 2008 Put the bottom code in the top code where it says "Latest free agents" and replace all the " with \" if and ONLY if the " is outside of the <? ?> tags. Side note: you might consider replacing <? with <?php, it's just better practice. Quote Link to comment https://forums.phpfreaks.com/topic/117856-need-help/#findComment-606204 Share on other sites More sharing options...
DeanWhitehouse Posted August 2, 2008 Share Posted August 2, 2008 soz, that code wont work <?php if($index == yes) { ?> <div class='maincontentbg'> <table width="600" border="0" cellspacing="2" cellpadding="1"> <tr> <td> <div class="bottomrighsidebar"></div> <div class="toprighsidebartitle">Latest Free Agents</div> <div class="toprighsidebarbg"><table width="90%" align="center" bgcolor="#000000" cellspacing="1"> <?php $latestagents = mysql_query("SELECT freeagents.id, gamename, game FROM freeagents LEFT JOIN ladders ON freeagents.ladder = ladders.id ORDER BY freeagents.id DESC LIMIT 0,6"); while(list($freeagentsuser,$freeagentsgamename,$laddersgame)=mysql_fetch_row($latestagents)) { if($config[cellbgx]==$config[cellbg]) { $config[cellbgx]="$config[cellbg2]"; } else { $config[cellbgx]="$config[cellbg]"; } echo"<tr bgcolor='$config[altcolora]'><td background='$config[cellbgx]'><a href='./freeagents.php?action=viewagent&agent=$freeagentsuser'><span style='color:#FFFFFF;'>$freeagentsgamename $laddersgame</span></a></td></tr>"; } ?> </table> </div> ...? </td> <td>Spolight Profile</td> </tr> </table> </div> <?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/117856-need-help/#findComment-606206 Share on other sites More sharing options...
AndrewVlcek Posted August 2, 2008 Author Share Posted August 2, 2008 I got it! Thanks soooooo much. I have been trying to figure this out for a week. Quote Link to comment https://forums.phpfreaks.com/topic/117856-need-help/#findComment-606273 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.