Jump to content

[SOLVED] basic php help


SN1P3R_85

Recommended Posts

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>";

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

<?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>

Link to comment
Share on other sites

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>";

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.