PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Charles256
DevNet Resident
Posts: 1375 Joined: Fri Sep 16, 2005 9:06 pm
Post
by Charles256 » Fri Nov 25, 2005 5:42 pm
erm.change it to PHP tags?
Jenk
DevNet Master
Posts: 3587 Joined: Mon Sep 19, 2005 6:24 am
Location: London
Post
by Jenk » Fri Nov 25, 2005 6:26 pm
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.
gaogier
Forum Contributor
Posts: 391 Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:
Post
by gaogier » Sat Nov 26, 2005 4:19 am
so how could i fix it?
Jenk
DevNet Master
Posts: 3587 Joined: Mon Sep 19, 2005 6:24 am
Location: London
Post
by Jenk » Sat Nov 26, 2005 11:57 am
remove the line.
Ambush Commander
DevNet Master
Posts: 3698 Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US
Post
by Ambush Commander » Sat Nov 26, 2005 5:00 pm
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.
gaogier
Forum Contributor
Posts: 391 Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:
Post
by gaogier » Sun Nov 27, 2005 12:04 pm
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
Jenk
DevNet Master
Posts: 3587 Joined: Mon Sep 19, 2005 6:24 am
Location: London
Post
by Jenk » Sun Nov 27, 2005 12:26 pm
and what do you think that error message is telling you?
gaogier
Forum Contributor
Posts: 391 Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:
Post
by gaogier » Sun Nov 27, 2005 12:28 pm
i dont know what it means?
T_ELSE?
Jenk
DevNet Master
Posts: 3587 Joined: Mon Sep 19, 2005 6:24 am
Location: London
Post
by Jenk » Sun Nov 27, 2005 12:37 pm
What is on line 51 that could possibly cause an error with T_ELSE message?
T_ELSE... else.. T_ELSE... else...
gaogier
Forum Contributor
Posts: 391 Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:
Post
by gaogier » Sun Nov 27, 2005 12:44 pm
so i delete that?
gaogier
Forum Contributor
Posts: 391 Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:
Post
by gaogier » Sun Nov 27, 2005 12:46 pm
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
Jenk
DevNet Master
Posts: 3587 Joined: Mon Sep 19, 2005 6:24 am
Location: London
Post
by Jenk » Sun Nov 27, 2005 12:49 pm
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
gaogier
Forum Contributor
Posts: 391 Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:
Post
by gaogier » Sun Nov 27, 2005 12:50 pm
sorry, iv new to learning php, and really rusty with errors
is that errror saying its not connecting to the databse?
Jenk
DevNet Master
Posts: 3587 Joined: Mon Sep 19, 2005 6:24 am
Location: London
Post
by Jenk » Sun Nov 27, 2005 1:03 pm
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.
gaogier
Forum Contributor
Posts: 391 Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:
Post
by gaogier » Sun Nov 27, 2005 1:21 pm
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);
}
?>