thefollower Posted December 12, 2007 Share Posted December 12, 2007 I have a table which i want to display infomation between rows like a dynamic drop down type of thing only not all fancy graphics just simple.. how ever i attempted it but it failed miserably! To get an idea of what i am trying to do here is an explaination: imagine : Report 1 - View Report 2 - View Now you want to view report 1 so itll be like: Report 1 - View \/ [content] [content] [content] [content] Report 2 - View To do this i used used a Get in the "View" carrying the ID then that GET is pull out during the while loop so its after each row but it didnt work as the content was displayed above the table completely... This is what i got: <?php //row columns created earlier in script and the query etc while($row = mysql_fetch_assoc($GetReports)){ $RecordID = $row['RecordID']; $Info = $row['Log']; $ReportedPlayer = $row['ReportedPlayer']; $GetUserName = mysql_query("SELECT * FROM userregistration WHERE UserID='$ReportedPlayer'") or die(mysql_error()); $UserNameRow = mysql_fetch_assoc($GetUserName); $ReportedPlayer = $UserNameRow['Username']; ?> <tr> <td width="100"><center><font style="font-size:14px" color="#FFFFFF" face="Arial"><?=$ReportedPlayer?></center></font></td> <td width="100"><center><font style="font-size:14px" color="#FFFFFF" face="Arial"><a href="pendingreports.php?view=<?=$RecordID?>" style="color:#FFFFFF">View</a></center></font></td> </tr> <?php If(isset($_GET['view'])){ ?> <font style="font-size:13px" color="#FFFFFF" face="Arial">UserID: <?=$UserID?><br> UserName: <?=$UserName?><br> Money: <?=$Money?><br> <br> <a href="viewuerslogs.php?logs=<?=$UserID?>" style="color:#FFFFFFF">View user's logs</a><br> <a href="viewusersmessages.php?messages=<?=$UserID?>" style="color:#FFFFFF">View user's messages</a><br> <a href="Viewusersonsameip.php?ip=<?=$UserID?>" style="color:#FFFFFF">View user's on same IP</a></font></div> <b><u>Player Report Infomation:</u></b> <?=$Info?> <a href="closereport.php?report=<?=$RecordID?>" style="color:#FFFFFF">No Evidence</a><br> <br> <a href="secondopinion.php?report=<?=$RecordID?>" style="color:#FFFFFF">Get Second Opinion</a><br> <br> <a href="punishment.php?report=<?=$RecordID?>" style="color:#FFFFFF">Guilty</a></u></b></font></div> <? } } ?> Quote Link to comment Share on other sites More sharing options...
lemmin Posted December 12, 2007 Share Posted December 12, 2007 I'm not sure I understand what you are trying to do. Is it like a collapsible menu where when you click on Report 1 - View, content shows up underneath it? Why don't you have a <table> tag if that is what you are trying to make? Quote Link to comment Share on other sites More sharing options...
thefollower Posted December 12, 2007 Author Share Posted December 12, 2007 That is the table theres the row in a while loop you hit the nail on the head with what im trying to get it to do. Quote Link to comment Share on other sites More sharing options...
atticus Posted December 12, 2007 Share Posted December 12, 2007 o Quote Link to comment Share on other sites More sharing options...
lemmin Posted December 12, 2007 Share Posted December 12, 2007 Well the logic looks right to me. My guess is that either the first loop doesn't print out a "ReportedPlayer" and it does print out the stuff after view so it looks like it is above it, but it is really above the second one, or There is some crazy html issue, but hardly ever would that cause content to be displayed in the wrong order. I still don't see a <table> tag, though. Is it above your php that you pasted? I would look at the source and see if the html is printed out like you would expect. Even post the html source if you can't see what is wrong in it. Quote Link to comment Share on other sites More sharing options...
thefollower Posted December 12, 2007 Author Share Posted December 12, 2007 heres the full table: Hope you can help ! <?php <div id="bv_" style="position:absolute;left:160px;top:350px;width:150px;height:22px;z-index:1" align="center"> <table width="600" border="1" cellpadding="0" cellspacing="0"> <tr> <td width="200"><font style="font-size:14px" color="#FFFFFF" face="Arial"><center><b><u>User:</center></b></u></font></td> <td width="200"><font style="font-size:14px" color="#FFFFFF" face="Arial"><center><b><u>Report ID:</center></b></u></font></td> </tr> <? while($row = mysql_fetch_assoc($GetReports)){ $RecordID = $row['RecordID']; $Info = $row['Log']; $ReportedPlayer = $row['ReportedPlayer']; $GetUserName = mysql_query("SELECT * FROM userregistration WHERE UserID='$ReportedPlayer'") or die(mysql_error()); $UserNameRow = mysql_fetch_assoc($GetUserName); $ReportedPlayer = $UserNameRow['Username']; ?> <tr> <td width="100"><center><font style="font-size:14px" color="#FFFFFF" face="Arial"><?=$ReportedPlayer?></center></font></td> <td width="100"><center><font style="font-size:14px" color="#FFFFFF" face="Arial"><a href="pendingreports.php?view=<?=$RecordID?>" style="color:#FFFFFF">View</a></center></font></td> </tr> <? If(isset($_GET['view'])){ ?> <font style="font-size:13px" color="#FFFFFF" face="Arial">UserID: <?=$UserID?><br> UserName: <?=$UserName?><br> Money: <?=$Money?><br> <br> <a href="viewuerslogs.php?logs=<?=$UserID?>" style="color:#FFFFFFF">View user's logs</a><br> <a href="viewusersmessages.php?messages=<?=$UserID?>" style="color:#FFFFFF">View user's messages</a><br> <a href="Viewusersonsameip.php?ip=<?=$UserID?>" style="color:#FFFFFF">View user's on same IP</a></font></div> <b><u>Player Report Infomation:</u></b> <?=$Info?> <a href="closereport.php?report=<?=$RecordID?>" style="color:#FFFFFF">No Evidence</a><br> <br> <a href="secondopinion.php?report=<?=$RecordID?>" style="color:#FFFFFF">Get Second Opinion</a><br> <br> <a href="punishment.php?report=<?=$RecordID?>" style="color:#FFFFFF">Guilty</a></u></b></font></div> <? } } } ?> Quote Link to comment Share on other sites More sharing options...
thefollower Posted December 13, 2007 Author Share Posted December 13, 2007 bump Quote Link to comment Share on other sites More sharing options...
thefollower Posted December 13, 2007 Author Share Posted December 13, 2007 bump Quote Link to comment Share on other sites More sharing options...
Psycho Posted December 13, 2007 Share Posted December 13, 2007 Well, I'vre read your posts a couple times and don't really understand the problem you are describing. It would be helpful if you posted a link to the page haing the problem. From what I can ascertain, this is NOT a php proble. It is a problem with the HTML you are creating from the PHP code. I would suggest taking the HTML output andsaving it is as a flat file. Then modify the HTML to get it working. Then you can modify the PHP to match. But, I do see some issues: 1) You are using nested queries. I.e. you are doing a querie within a loop. This is horribly inefficient and creates a huge load on your server. As the data set gets larger you may run into timeout issues. You should write a single query to get all the data you need. 2) You are redefining the variable $ReportedPlayer twice in your loops to two different values. It should work, but it is bad practice. 3) You are suing PHP short tags. This is also bad practice because it is not always supported 4) Start using styles. The FONT tag has been deprecated for many years now. Quote Link to comment Share on other sites More sharing options...
revraz Posted December 13, 2007 Share Posted December 13, 2007 You should use java for this. Quote Link to comment Share on other sites More sharing options...
thefollower Posted December 13, 2007 Author Share Posted December 13, 2007 You should use java for this. People turn java off and it causes problems. The problem i have is this: The last bit of html in the script is not appearing inbetween the rows, it's being echoed above the entire table rather than being displayed under the row that the user is viewing... So it be like: Row - View When the person clicks view the info under the GET function will display below that row.. but "above" the rest of the rows in that table... so kinda like a drop down box like you get in javascript only not in graphical terms cos people kept turning javascript off and messing it about. Quote Link to comment Share on other sites More sharing options...
thefollower Posted December 13, 2007 Author Share Posted December 13, 2007 1) You are using nested queries. I.e. you are doing a querie within a loop. This is horribly inefficient and creates a huge load on your server. As the data set gets larger you may run into timeout issues. You should write a single query to get all the data you need. So would it still work if the query is outside the loop? So in the while loop i should only need to have the fetch_assoc function ? Quote Link to comment Share on other sites More sharing options...
revraz Posted December 13, 2007 Share Posted December 13, 2007 Use CSS to display it where you want it. Quote Link to comment Share on other sites More sharing options...
thefollower Posted December 13, 2007 Author Share Posted December 13, 2007 Ok sounds like this is going to cause more trouble than i want ill opt out and do a different method! Thanks for the help though guys. Ill fixed my nested queries..thanks for the heads up on that one. Quote Link to comment Share on other sites More sharing options...
lemmin Posted December 13, 2007 Share Posted December 13, 2007 You are adding information to a table not in a collumn or row. Just take out the </td> and </tr> right before the "If(isset($_GET['view'])){" and it should go into the same cell. If you wanted a new cell, use another <td> tag. When you want to end the table, use </table> 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.