SN1P3R_85 Posted September 14, 2008 Share Posted September 14, 2008 On one of my pages, none of the css is displayed, and neither is a certain table. If i take the html and put it in a file, it works fine, but in combination with the php, it doesn't work. Here is the code for the table, can you guys see anything wrong with it?: echo '<table class="forum_menu" border="1" width="10%">'; while ($row = mysql_fetch_assoc($sql_query)) { echo '<tr style="height:20px"><td class="forum" width="50%"><a href="/forum/forum_display.php?id=' . $row['Thread_id'] . '>' . $row['Thread_name'] . '</td></tr>'; } echo "</table>"; Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted September 14, 2008 Share Posted September 14, 2008 there are no syntax errors... try looking in the source code to see if something does not look right or if the code is completely absent. Try adding the line error_reporting(E_ALL) to the top of the page if no errors are currently being displayed. Post your script here and we can try to help. Quote Link to comment Share on other sites More sharing options...
SN1P3R_85 Posted September 14, 2008 Author Share Posted September 14, 2008 I added that line. all i got is this: Notice: Undefined index: User_level in /homepages/12/d222097102/htdocs/user.inc on line 11. This is a different script, and that undefined index is because of whitespace i think. Anyways, it shouldn't have anything to do with the forum_menu.php file. Quote Link to comment Share on other sites More sharing options...
SN1P3R_85 Posted September 14, 2008 Author Share Posted September 14, 2008 <?php error_reporting(E_ALL); include('../user.inc'); include('../SQL_PASS.inc'); if(!$user) { header('Location:http://www.caidenhome.com/access_denied.php'); } if(!$con) { die('could not connect: ' . mysql_error()); } if(!$db_select) { die('could not select database: ' . mysql_error()); } $sql_fetch = "SELECT * FROM `threads`"; $sql_query = mysql_query($sql_fetch); if(!$sql_fetch) { die('could not run query: ' . mysql_error()); } if (mysql_num_rows($sql_query)==0) { echo "<p>there are no threads at the moment</p>"; } else { echo '<table class="forum_menu" border="1" width="10%">'; while ($row = mysql_fetch_assoc($sql_query)) { echo '<tr style="height:20px"><td class="forum" width="50%"><a href="/forum/forum_display.php?id=' . $row['Thread_id'] . '>' . $row['Thread_name'] . '</td></tr>'; } echo "</table>"; } ?> <html> <head> <title>forum_menu</title> <link rel="stylesheet" type="text/css" href="/css/standard.css" /> </head> <body> <table class="lnk_bar" border="1" width="100%"> <tr> <td width="20%"><b><a href="/index.php">home</a></b></td> <td width="20%"><b><a href="/calc.php">calculator</a></b></td> <td width="20%"><b><a href="/cobolt.mp3">song</a></b></td> <td width="20%"><b><a href="/forums/forum_menu.php">forum</a></b></td> <td width="20%"><b><a href="/register.php">register</a></b></td> </tr> </table> <a class="thread_create" href="/forum/create_thread.php">start thread</a> </body> </html> Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted September 14, 2008 Share Posted September 14, 2008 change the line if(!$sql_fetch) to if(!$sql_query) and see if that displays the "could not run query...." error. edit: also, the error you're getting is because you're using an array index that doesn't exist... such as $array['User_level']; where "User_level" is not an existing key. Quote Link to comment Share on other sites More sharing options...
SN1P3R_85 Posted September 14, 2008 Author Share Posted September 14, 2008 i made that change, and it still wont' display the correct css Quote Link to comment Share on other sites More sharing options...
SN1P3R_85 Posted September 14, 2008 Author Share Posted September 14, 2008 im pretty sure the part thats messing it up is this, because when i comment it out, the page displays fine. echo '<table class="forum_menu" border="1" width="10%">'; while ($row = mysql_fetch_assoc($sql_query)) { echo '<tr style="height:20px"><td class="forum" width="50%"><a href="/forum/forum_display.php?id=' . $row['Thread_id'] . '>' . $row['Thread_name'] . '</td></tr>'; } echo "</table>"; Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted September 14, 2008 Share Posted September 14, 2008 now I see it echo '<table class="forum_menu" border="1" width="10%">'; while ($row = mysql_fetch_assoc($sql_query)) { echo '<tr style="height:20px"><td class="forum" width="50%"><a href="/forum/forum_display.php?id=' . $row['Thread_id'] . '">' . $row['Thread_name'] . '</a></td></tr>'; } echo "</table>"; is what you should change it to... look for the quote and < /a> I added at the end of the <a> tag. Quote Link to comment Share on other sites More sharing options...
SN1P3R_85 Posted September 14, 2008 Author Share Posted September 14, 2008 thanks alot man, im still fairly new to php, started it around a month ago. 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.