TheChaosFactor Posted July 28, 2010 Share Posted July 28, 2010 Ok, so I have grabbed a free template and attempted to put a dynamic table into one of the div's. I've got it to work on on my index.php, but I copied and pasted the entire code into member2.php and only changed the query and altered the table just a little bit For some reason though my table doesn't show up on the member2.php even though 90% of the code is the same. Here are the pages and codes... http://www.royalfamilyhosting.com/test/index.php <div id="layoutBodyContent"> <h1>Aces Guild Donations Page </h1> <h2>Are you on top of your game? WE are!</h2> <?PHP require_once('./mylib.php'); $rank = 1; $olddate = strtotime(date("Y-m-d")); $newdate; $datecounter = 1; //connects to db dbconnect(); $query="SELECT name, date, SUM(amount) as total_money, SUM(bricks) as total_bricks FROM Aces_Donations GROUP BY Name ORDER BY total_money DESC, total_bricks DESC"; $result=mysql_query($query); //Opens the table echo "<table border = '3' width = 40% bgcolor=#A85045><caption><center>30 Day Rankings".'</center></caption>'; //Loop to run until eof while($row = mysql_fetch_array($result)){ //turns date into a comparable string $newdate = strtotime($row['date']); /*checks to see if date of new record matches date of previous record. If dates dont match the table is closed and a new table is opened for the new date. Rank is reset to reflect rankings for each specific date*/ if($newdate !== $olddate){ $olddate = $newdate; $datetracker++; if($datetracker == 30){ echo "<center><tr><td alignment = 'center'>".$rank."</td> <td alignment = 'center'>".$row['name']. "</td><td alignment = 'center'>". $row['total_money']."</td><td alignment= 'center'>".$row['total_bricks']."</tr></table></center>"; break; } } echo "<center><tr><td alignment = 'center'>".$rank."</td> <td alignment = 'center'>".$row['name']. "</td><td alignment = 'center'>". $row['total_money']."</td><td alignment= 'center'>".$row['total_bricks'].'</td></tr>'; echo '<br />'; $rank++; } echo '</table>'; ?> <br /><br /></p> </div> http://www.royalfamilyhosting.com/test/member2.php?member=Zneve08 <div id="layoutBodyContent"> <h1>Aces Guild Donations Page </h1> <h2>Are you on top of your game? WE are!</h2> <?PHP require_once('./mylib.php'); $membername = $_GET['member']; $rank = 1; $olddate = strtotime(date("Y-m-d")); $newdate; $datecounter = 1; //connects to db dbconnect(); $query = sprintf("SELECT * FROM `Aces_Donations` WHERE `name` = '%s'", $membername); //sets the results to a variable $result = mysql_query($query) or die(mysql_error()); //opens table, sets width, color, border and headers echo '<table bgcolor=#A85045 border = "3" width = 40%>'; echo "<tr><th alignment = 'center'>Member</th> <th alignment = 'center'>Amount</th><th alignment = 'center'>Date</th></tr>"; while($row = mysql_fetch_array($result)){ echo "<center><tr><td alignment = 'center'>".$row['name']. "</td><td alignment = 'center'>". $row['amount']."</td><td alignment = 'center'>".$row['date']."</td></tr></center>"; var_dump ($row['name']); var_dump ($row['amount']); echo "<br />"; } echo '</center></table>'; ?> <br /><br /></p> </div> I'm dying here and would love even shot in the dark at this point. The php code on member2.php works just fine when executed on its own page, so I don't really understand how this is happening. I put the var_dump in there just to make sure the data was being retrieved from the database, but the table should be positioned where the var_dump displays on the page Quote Link to comment https://forums.phpfreaks.com/topic/209153-two-nearly-identical-pages-two-very-different-results/ Share on other sites More sharing options...
Pikachu2000 Posted July 28, 2010 Share Posted July 28, 2010 Why are you using var_dump() to try to echo data? Nevermind. Didn't see the text under the second code block . . . Quote Link to comment https://forums.phpfreaks.com/topic/209153-two-nearly-identical-pages-two-very-different-results/#findComment-1092303 Share on other sites More sharing options...
TheChaosFactor Posted July 28, 2010 Author Share Posted July 28, 2010 Just something I typed in real quick to see if the database was being queried correctly. Even without that though the script does not work even though the first one does. Quote Link to comment https://forums.phpfreaks.com/topic/209153-two-nearly-identical-pages-two-very-different-results/#findComment-1092306 Share on other sites More sharing options...
Pikachu2000 Posted July 28, 2010 Share Posted July 28, 2010 It is echoing the data; it's present in the html source. This is an html validity issue. alignment is not a valid attribute, and you don't use <center> tags within the table structure like that. Try this. echo "<table bgcolor=\"#A85045\" border=\"3\" width=\"40%\">\n<tr>\n<th align=\"center\">Member</th>\n <th align=\"center\">Amount</th>\n<th align=\"center\">Date</th>\n</tr>\n"; while($row = mysql_fetch_array($result)){ echo "<tr>\n<td align=\"center\">{$row['name']}</td>\n<td align=\"center\">{$row['amount']}</td>\n<td align=\"center\">{$row['date']}</td>\n</tr>\n"; //var_dump ($row['name']); //var_dump ($row['amount']); } echo "</table>"; Quote Link to comment https://forums.phpfreaks.com/topic/209153-two-nearly-identical-pages-two-very-different-results/#findComment-1092320 Share on other sites More sharing options...
TheChaosFactor Posted July 28, 2010 Author Share Posted July 28, 2010 Still got nothing on the page, but it's still showing up in the source code... Also, if you go to just http:www.royalfamilyhosting.com/test/member2.php and then add on "?member=Zneve08" and and go to the same page with some info passed, you can see the div container get bigger, so it knows there's something in there. I maybe should have mentioned that the other one is positioned with css like so: table a, table, tbody, tfoot, tr, th, td, table caption { font-family: Verdana, arial, helvetica, sans-serif; background:#262b38; color:#fff; text-align:left; font-size:12px; position:relative; bottom: xxxpx; left:xxxpx; } I've tried adjusting the bottom and left values as well as removing those parameters and I still get no change at all... Quote Link to comment https://forums.phpfreaks.com/topic/209153-two-nearly-identical-pages-two-very-different-results/#findComment-1092343 Share on other sites More sharing options...
Pikachu2000 Posted July 28, 2010 Share Posted July 28, 2010 Yeah, it's definitely there in the source. Maybe a mod can move this to the CSS help forum. You'll probably have better luck getting help with this there. Quote Link to comment https://forums.phpfreaks.com/topic/209153-two-nearly-identical-pages-two-very-different-results/#findComment-1092375 Share on other sites More sharing options...
Masterprise Posted July 28, 2010 Share Posted July 28, 2010 Quote Still got nothing on the page, but it's still showing up in the source code... Also, if you go to just http:www.royalfamilyhosting.com/test/member2.php and then add on "?member=Zneve08" and and go to the same page with some info passed, you can see the div container get bigger, so it knows there's something in there. I maybe should have mentioned that the other one is positioned with css like so: table a, table, tbody, tfoot, tr, th, td, table caption { font-family: Verdana, arial, helvetica, sans-serif; background:#262b38; color:#fff; text-align:left; font-size:12px; position:relative; bottom: xxxpx; left:xxxpx; } I've tried adjusting the bottom and left values as well as removing those parameters and I still get no change at all... try just changing the 'bottom:xxxpx;' to 'bottom:0px;' it worked for me (in Firefox, IE looks bad no matter which page). The reason it wasn't displaying is that 325px makes the table go outside of the div#layoutBodyContent element, which makes it disappear. Anyway, another thing I notices is that above the 'table a, table, tbody, tfoot, tr, th, td, table caption' are #tbldisplay table a, table, tbody, tfoot, tr, th, td, table caption {...} #tbldisplayall table a, table, tbody, tfoot, tr, th, td, table caption {...} #tbldisplay3 table a, table, tbody, tfoot, tr, th, td, table caption {...} The ', table,' in all of those parts are causing the table to be changed 4 times. So the bottom (and such) for the table is being set to 375 to 500 to 375 and finally to 325. Also, I would would definitely do what Pikachu2000 said, alignment is not a valid attribute, etc. Fixing this would probably fix the ugly tables I see using IE on the pages. Quote Link to comment https://forums.phpfreaks.com/topic/209153-two-nearly-identical-pages-two-very-different-results/#findComment-1092378 Share on other sites More sharing options...
Pikachu2000 Posted July 28, 2010 Share Posted July 28, 2010 Yup, Masterprise nailed it. I forgot all about the developer tools in Safari. I changed the bottom:325px attribute to 0px, and it showed up where it's supposed to be. That was a good catch. Quote Link to comment https://forums.phpfreaks.com/topic/209153-two-nearly-identical-pages-two-very-different-results/#findComment-1092383 Share on other sites More sharing options...
TheChaosFactor Posted July 28, 2010 Author Share Posted July 28, 2010 Quote try just changing the 'bottom:xxxpx;' to 'bottom:0px;' it worked for me (in Firefox, IE looks bad no matter which page). The reason it wasn't displaying is that 325px makes the table go outside of the div#layoutBodyContent element, which makes it disappear. Anyway, another thing I notices is that above the 'table a, table, tbody, tfoot, tr, th, td, table caption' are #tbldisplay table a, table, tbody, tfoot, tr, th, td, table caption {...} #tbldisplayall table a, table, tbody, tfoot, tr, th, td, table caption {...} #tbldisplay3 table a, table, tbody, tfoot, tr, th, td, table caption {...} The ', table,' in all of those parts are causing the table to be changed 4 times. So the bottom (and such) for the table is being set to 375 to 500 to 375 and finally to 325. Also, I would would definitely do what Pikachu2000 said, alignment is not a valid attribute, etc. Fixing this would probably fix the ugly tables I see using IE on the pages. Ok, you nailed it. Changing it to "bottom:0px;" did it for member2.php but it messed up my index.php because that 325px was what put the table where it should be on that page. I can live with multiple stylesheets though. Thank both you guys for all your help. I really appreciate it. Quote Link to comment https://forums.phpfreaks.com/topic/209153-two-nearly-identical-pages-two-very-different-results/#findComment-1092386 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.