Saturday, 31 August 2013

Notice: Undefined index: topic_creator in

Notice: Undefined index: topic_creator in

How do i fix Notice: Undefined index: topic_creator in
C:\wamp\www\forum\view_category.php on line 313 Im getting two off this
errors. I did read on a page that putting @ infront of $topic_creator may
help, but i dident. I cant find a place that says how to fix it, so please
help me. Here is my code
include_once("connect.php");
$sql = "SELECT id FROM categories WHERE id='".$cid."' LIMIT 1";
$res = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($res) == 1) {
$sql2 = "SELECT * FROM topics WHERE category_id='".$cid."' ORDER BY
topic_reply_date DESC";
$res2 = mysql_query($sql2) or die(mysql_error());
if (mysql_num_rows($res2) > 0) {
while ($row = mysql_fetch_assoc($res)) {
**Line 313** if($row['topic_last_user']== "") { $last_user =
getusername($row['topic_creator']); } else { $last_user =
getusername($row['topic_creator']); }
$topics .="
<li class='category'><div class='left_cat'>
<a class='underline' href='view_topic.php?cid=".$cid."&tid=".$tid."'>
<div class='title'><i
class='icon-comment'></i>&nbsp;".$title."</div></a>
<div class='info'><i class='icon-comments
icon-1'></i>&nbsp;".topicreplies($cid, $tid)." Comments&nbsp;
&nbsp; &nbsp;<i class='icon-user icon-1'>
&nbsp;</i>".$last2_user."&nbsp; ".$last_user."

No comments:

Post a Comment