adrian5117 Posted October 23, 2008 Share Posted October 23, 2008 i wrote most of this script. I want the <div> to contain the PHP content afterwards by using this kind of format: <div> <?php echo $content ?> ?> </div> but the <div> stops reading data as soon as it hits a ?> (end php read) can anyone help me? this page is at www.xanthos.co.nr/item when you load the page, search for Zubei (only the armor section is working right now.. well, kinda) after you get the results, click on DROP INFORMATION. the whole list of drops should disappear, but only the headers of the table (containing the information) does. Thanks in advance SOURCE: <html oncontextmenu="return false" ondrag="return false"> <head> <title>L2Xanthos</title> <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE"> <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE"> <META HTTP-EQUIV="CONTENT-LANGUAGE" CONTENT="en-US"> <META HTTP-EQUIV="EXPIRES" CONTENT="Mon, 22 Jul 2000 11:12:01 GMT"> <META NAME="KEYWORDS" CONTENT="Lineage 2, Lineage II, L2, L2Xanthos, Lineage 2 Xanthos, Lineage II Xanthos, MMORPG"> <META NAME="ROBOTS" CONTENT="INDEX,NOFOLLOW"> <meta http-equiv='imagetoolbar' content='no'> <style type="text/css"> body { scrollbar-base-color: 000000; scrollbar-arrow-color: FFCC00; scrollbar-3dlight-color: BDB09D; scrollbar-darkshadow-color: 7C6F60; scrollbar-face-color: 000000; scrollbar-highlight-color: 7C6F60; scrollbar-shadow-color: 897C6C; scrollbar-track-color: BDB09D; } </style> <script language="JavaScript"> function dothis() { if((document.all.q.value == ' ') || (document.all.q.value == ' ')) {document.all.q.value = '';} if((document.all.q.value == '') || (document.all.q.value.length < 2)) {document.all.s.disabled=true;} else {document.all.s.disabled=false;} } </script> <script type="text/javascript"> function toggle(id) { var e = document.getElementById(id); if(e.style.display=='block') { e.style.display='none'; } else { e.style.display='block'; } } </script> </head> <?php include '../ip.php'; mysql_connect("$dbhost", "$dbuser", "$dbpass") or die('<body bgcolor=897C6C scroll=no><font color=red><center>Error connecting to mysql.<br>'.mysql_error().'</font><br><button onclick=history.go(-1)>OK</button>'); mysql_select_db("$dbname") or die ('<body bgcolor=897C6C scroll=no><font color=red><center>Error connecting to Database.<br>'.mysql_error().'</font><br><button onclick=history.go(-1)>OK</button>'); $q = mysql_real_escape_string($_POST["q"]); $m = mysql_real_escape_string($_POST["m"]); ?> <body bgcolor=897C6C onload=document.all.m<?php echo $m; ?>.checked=true> <center> <form action=drop.php method=post autocomplete=no name=search style=margin-bottom:0> <fieldset style=width:180><legend style=color:ffcc00>Name/ID Contains </legend> <input type=text id=q name=q value=<?php echo $q ?> size=22 style=text-align:center;background-color:FFCC00;font-size:13 onfocus=dothis() onblur=dothis() onkeyup=dothis() onkeydown=dothis() onkeypress=dothis() onchange=dothis()></fieldset><br> <fieldset style=width:180><legend style=color:ffcc00>Sort By </legend> <label for=m0>(A-Z,1-9) NAME, ID</label><input type=radio id=m0 name=m value='0' style=background-color:FFCC00><br> <label for=m1>(1-9,A-Z) ID, NAME</label><input type=radio id=m1 name=m value='1' style=background-color:FFCC00><br> <label for=m2>(Z-A,9-1) NAME, ID</label><input type=radio id=m2 name=m value='2' style=background-color:FFCC00><br> <label for=m3>(9-1,Z-A) ID, NAME</label><input type=radio id=m3 name=m value='3' style=background-color:FFCC00></fieldset><br> <input type=button name=s id=s hidefocus=true value=FIND onclick=document.search.submit() style=position:relative;top:6> </form> <?php echo '<table bgcolor=red border=5 bordercolor=green>'; echo '<tr>'; echo '<td align=center valign=top>'; $x=0; $y=1; $search = "name LIKE '%$q%' OR item_id LIKE '%$q%'"; if($m==0) { $order = "name ASC, item_id ASC"; } if($m==1) { $order = "item_id ASC, name ASC"; } if($m==2) { $order = "name DESC, item_id DESC"; } if($m==3) { $order = "item_id DESC, name DESC"; } echo '<table bgcolor=gray border=2 bordercolor=ffcc00>'; echo '<tr><th align=center colspan=5>ARMOR</th></tr>'; echo '<tr><td align=center colspan=1>ITEM ID</td><td align=center colspan=4>ITEM NAME</td></tr>'; $result = mysql_query("SELECT * FROM armor WHERE $search ORDER BY $order"); $row = mysql_num_rows($result); if($row==0) { echo "<tr><td align=center colspan=5><font color=FF0000>No results from ARMOR</font></td></tr>"; } else { $t = 0; while ($row = mysql_fetch_row($result)) { $x++; if($x %2) {$bgc = 'style=background-color:505050';} else {$bgc = 'style=background-color:808080';} echo '<tr>'; echo "<td $bgc align=center colspan=1><font color=00FF00>$row[0]</font></td>"; echo "<td $bgc align=center colspan=4><font color=00FF00>$row[1]</font></td>"; echo '</tr>'; $resultdrop = mysql_query("SELECT * FROM droplist WHERE itemId = '$row[0]' ORDER BY chance DESC, category DESC"); $rowdrop = mysql_num_rows($resultdrop); if($rowdrop==0) { echo '<tr>'; echo "<td></td><td align=center colspan=5><font color=white>Not dropped</font></td>"; echo '</tr>'; } else { ?> <td align=center colspan=5 onclick="toggle(<?php echo $t; ?>)" style=cursor:hand><font color=white>DROP INFORMATION</font></td> <?php echo '<tr>'; echo '</tr>'; echo '<tr>'; echo '<td align=center colspan=5>'; ?> <div id=<?php echo $t ?> style=display:block> <table width=100%> <tr> <td align=center width=12%><font color=black>Level</font></td> <td align=center width=22%><font color=red>Monster</font></td> <td align=center width=22%><font color=cyan>Method</font></td> <td align=center width=22%><font color=brown>Quantity</font></td> <td align=center width=22%><font color=purple>Chance</font></td> </tr> </table> </td> </tr> <?php while ($resultmob = mysql_fetch_row($resultdrop)) { $resultdropper = mysql_query("SELECT * FROM npc WHERE id = '$resultmob[0]'"); $resultdroppername = mysql_fetch_row($resultdropper); if($resultmob[4]==-1) {$how = '<font color=blue>Spoil';} else {$how = '<font color=red>Drop';} $x1++; if($x1 %2) {$bgc1 = 'style=background-color:7C6F60';} else {$bgc1 = 'style=background-color:897C6C';} if($resultmob[2]==$resultmob[3]) {$ending = '';} else {$ending = "-$resultmob[3]";} $chance = $resultmob[5]/10000; ?> <tr> <td align=center colspan=5> <table width=100%> <tr> <td width=12% <?php echo $bgc1 ?> align=center><font color=FFCC00><?php echo $resultdroppername[9] ?></font></td> <td width=22% <?php echo $bgc1 ?> align=center><form action=../monsterinfo/map.php method=post style=margin-bottom:0><input type=hidden name=monsi value=<?php echo $resultdroppername[0] ?>><button type=submit hidefocus=true>MAP</button></form><font color=FFCC00><?php echo $resultdroppername[2] ?></font></td> <td width=22% <?php echo $bgc1 ?> align=center><?php echo $how ?></font></td> <td width=22% <?php echo $bgc1 ?> align=center><font color=FFCC00><?php echo $resultmob[2] ?><?php echo $ending ?></font></td> <td width=22% <?php echo $bgc1 ?> align=center><font color=FFCC00><?php echo $chance ?>%</font></td> </tr> </table> </td> </tr> <?php } ?> </div> <?php $t++; } } } $x++; echo '</table>'; echo '</td><td align=center valign=top>'; echo '<table bgcolor=gray border=2 bordercolor=ffcc00>'; echo '<tr><th align=center colspan=2>ETCITEM</th></tr>'; echo '<tr><th align=center>ITEM ID</th><th align=center>ITEM NAME</th></tr>'; $result1 = mysql_query("SELECT * FROM etcitem WHERE $search ORDER BY $order"); $row1 = mysql_num_rows($result1); if($row1==0) { echo "<tr><td colspan=2 align=center><font color=FF0000>No results from ETCITEM</font></td></tr>"; } while ($row1 = mysql_fetch_row($result1)) { $x++; if($x %2) {$bgc = 'style=background-color:505050';} else {$bgc = 'style=background-color:808080';} echo '<tr>'; echo "<td $bgc align=center><font color=00FF00>$row1[0]</font></td>"; echo "<td $bgc align=center><font color=00FF00>$row1[1]</font></td>"; echo '</tr>'; $resultdrop2 = mysql_query("SELECT * FROM droplist WHERE itemId = '$row1[0]' ORDER BY chance DESC, category DESC"); $rowdrop2 = mysql_num_rows($resultdrop2); if($rowdrop2==0) { echo '<tr>'; echo "<td></td><td align=center><font color=white>Not dropped</font></td>"; echo '</tr>'; } else { echo '<tr>'; echo "<td align=center colspan=4><font color=white>DROP INFORMATION</font></td>"; echo '</tr>'; echo '<tr>'; echo '<td align=center colspan=2>'; echo '<table width=100%>'; echo '<tr>'; echo "<td align=center width=12%><font color=black>Level</font></td>"; echo "<td align=center width=22%><font color=red>Monster</font></td>"; echo "<td align=center width=22%><font color=cyan>Method</font></td>"; echo "<td align=center width=22%><font color=brown>Quantity</font></td>"; echo "<td align=center width=22%><font color=purple>Chance</font></td>"; echo '</tr>'; echo '</table>'; echo '</td>'; echo '</tr>'; while ($resultmob2 = mysql_fetch_row($resultdrop2)) { $resultdropper2 = mysql_query("SELECT * FROM npc WHERE id = '$resultmob2[0]'"); $resultdroppername2 = mysql_fetch_row($resultdropper2); if($resultmob2[4]==-1) {$how2 = '<font color=blue>Spoil';} else {$how2 = '<font color=red>Drop';} $x2++; if($x2 %2) {$bgc2 = 'style=background-color:7C6F60';} else {$bgc2 = 'style=background-color:897C6C';} if($resultmob2[2]==$resultmob2[3]) {$ending2 = '';} else {$ending2 = "-$resultmob2[3]";} $chance2 = $resultmob2[5]/10000; echo '<tr>'; echo '<td align=center colspan=2>'; echo '<table width=100%>'; echo '<tr>'; echo "<td width=12% $bgc2 align=center><font color=FFCC00>$resultdroppername2[9]</font></td>"; echo "<td width=22% $bgc2 align=center><form action=../monsterinfo/map.php method=post style=margin-bottom:0><input type=hidden name=monsi value=$resultdroppername2[0]><button type=submit hidefocus=true>MAP</button></form><font color=FFCC00>$resultdroppername2[2]</font></td>"; echo "<td width=22% $bgc2 align=center>$how2</font></td>"; echo "<td width=22% $bgc2 align=center><font color=FFCC00>$resultmob2[2]$ending2</font></td>"; echo "<td width=22% $bgc2 align=center><font color=FFCC00>$chance2%</font></td>"; echo '</tr>'; echo '</table>'; echo "</td>"; echo '</tr>'; } } } $x++; echo '</table>'; echo '</td><td align=center valign=top>'; echo '<table bgcolor=gray border=2 bordercolor=ffcc00>'; echo '<tr><th align=center colspan=2>WEAPON</th></tr>'; echo '<tr><th align=center>ITEM ID</th><th align=center>ITEM NAME</th></tr>'; $result2 = mysql_query("SELECT * FROM weapon WHERE $search ORDER BY $order"); $row2 = mysql_num_rows($result2); if($row2==0) { echo "<tr><td colspan=2 align=center><font color=FF0000>No results from WEAPON</font></td></tr>"; } while ($row2 = mysql_fetch_row($result2)) { $x++; if($x %2) {$bgc = 'style=background-color:505050';} else {$bgc = 'style=background-color:808080';} echo '<tr>'; echo "<td $bgc align=center><font color=00FF00>$row2[0]</font></td>"; echo "<td $bgc align=center><font color=00FF00>$row2[1]</font></td>"; echo '</tr>'; $resultdrop3 = mysql_query("SELECT * FROM droplist WHERE itemId = '$row2[0]' ORDER BY chance DESC, category DESC"); $rowdrop3 = mysql_num_rows($resultdrop3); if($rowdrop3==0) { echo '<tr>'; echo "<td></td><td align=center><font color=white>Not dropped</font></td>"; echo '</tr>'; } else { echo '<tr>'; echo "<td align=center colspan=4><font color=white>DROP INFORMATION</font></td>"; echo '</tr>'; echo '<tr>'; echo '<td align=center colspan=2>'; echo '<table width=100%>'; echo '<tr>'; echo "<td align=center width=12%><font color=black>Level</font></td>"; echo "<td align=center width=22%><font color=red>Monster</font></td>"; echo "<td align=center width=22%><font color=cyan>Method</font></td>"; echo "<td align=center width=22%><font color=brown>Quantity</font></td>"; echo "<td align=center width=22%><font color=purple>Chance</font></td>"; echo '</tr>'; echo '</table>'; echo '</td>'; echo '</tr>'; while ($resultmob3 = mysql_fetch_row($resultdrop3)) { $resultdropper3 = mysql_query("SELECT * FROM npc WHERE id = '$resultmob3[0]'"); $resultdroppername3 = mysql_fetch_row($resultdropper3); if($resultmob3[4]==-1) {$how3 = '<font color=blue>Spoil';} else {$how3 = '<font color=red>Drop';} $x3++; if($x3 %2) {$bgc3 = 'style=background-color:7C6F60';} else {$bgc3 = 'style=background-color:897C6C';} if($resultmob3[2]==$resultmob3[3]) {$ending3 = '';} else {$ending3 = "-$resultmob3[3]";} $chance3 = $resultmob3[5]/10000; echo '<tr>'; echo '<td align=center colspan=2>'; echo '<table width=100%>'; echo '<tr>'; echo "<td width=12% $bgc3 align=center><font color=FFCC00>$resultdroppername3[9]</font></td>"; echo "<td width=22% $bgc3 align=center><form action=../monsterinfo/map.php method=post style=margin-bottom:0><input type=hidden name=monsi value=$resultdroppername3[0]><button type=submit hidefocus=true>MAP</button></form><font color=FFCC00>$resultdroppername3[2]</font></td>"; echo "<td width=22% $bgc3 align=center>$how3</font></td>"; echo "<td width=22% $bgc3 align=center><font color=FFCC00>$resultmob3[2]$ending3</font></td>"; echo "<td width=22% $bgc3 align=center><font color=FFCC00>$chance3%</font></td>"; echo '</tr>'; echo '</table>'; echo "</td>"; echo '</tr>'; } } } echo '</table>'; echo '</td></tr></table>'; //close MySQL connection mysql_close(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/129817-non-php-div-containing-sqlphp-content/ 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.