Page 2 of 3

Posted: Fri Nov 25, 2005 5:42 pm
by Charles256
erm.change it to PHP tags?

Posted: Fri Nov 25, 2005 6:26 pm
by Jenk

Code: Select all

$post_new = '<a href="http://www.nozhosting.com/forums/posting.php?mode=reply&t='.$topic.'">Post a comment</a>';
            }
           /* '.$news; // THIS IS THE LINE AT FAULT! */
            }else{
               $news1 = $news;
            }
That line looks like it shouldn't be there at all, I have commented it.

Posted: Sat Nov 26, 2005 4:19 am
by gaogier
so how could i fix it?

Posted: Sat Nov 26, 2005 11:57 am
by Jenk
remove the line.

Posted: Sat Nov 26, 2005 5:00 pm
by Ambush Commander
It's actually quite obvious once highlighting is on... the question is why was it there?

Such a jumble of spaghetti code: you could have at least indented it consistently.

Posted: Sun Nov 27, 2005 12:04 pm
by gaogier
if i delete that line i get this error

Parse error: parse error, unexpected T_ELSE in /home/nozhost/public_html/news.inc on line 51

Posted: Sun Nov 27, 2005 12:26 pm
by Jenk
and what do you think that error message is telling you?

Posted: Sun Nov 27, 2005 12:28 pm
by gaogier
i dont know what it means?

T_ELSE?

Posted: Sun Nov 27, 2005 12:37 pm
by Jenk
What is on line 51 that could possibly cause an error with T_ELSE message?

T_ELSE... else.. T_ELSE... else... ;)

Posted: Sun Nov 27, 2005 12:44 pm
by gaogier
so i delete that?

Posted: Sun Nov 27, 2005 12:46 pm
by gaogier
kk, i deleted that, and now i have this error

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/nozhost/public_html/news.inc on line 13

Posted: Sun Nov 27, 2005 12:49 pm
by Jenk
Dude, I don't mean to be rude... but are you even trying to investigate these errors for yourself?

I don't mean to ward you off, I am happy to help, but please.. atleast try to fix them before just posting on here :)

Posted: Sun Nov 27, 2005 12:50 pm
by gaogier
sorry, iv new to learning php, and really rusty with errors

is that errror saying its not connecting to the databse?

Posted: Sun Nov 27, 2005 1:03 pm
by Jenk
That is a possible cause.

For every mysql command you have, put die(mysql_error()); after it, for example:

Code: Select all

mysql_query("SELECT * FROM table") or die(mysql_error());
Do the same on the mysql_connect.

This will give a descriptive error where things are wrong.

Posted: Sun Nov 27, 2005 1:21 pm
by gaogier
it has that

Code: Select all

<?php

$dbcnx = mysql_connect("localhost", "gaming_gaogier", "password")
  or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("gaming_phpbb1");

function escape_data1 ($data){
   global $dbh;
   if (ini_get('magic_quotes_gpc')){
      $data = stripslashes($data);
   }
   return mysql_real_escape_string (trim ($data), $dbh);
}

?>