Version: , by (Guest)
Developer Last Online: Jan 1970
Version: Unknown
Rating:
Released: 01-18-2001
Last Update: Never
Installs: 0
No support by the author.
Hey guys... having a little trouble here, and hopefully somebody can shed some light on the problem...
I'm trying to include some vB login info in the header of my new site, which I'm coding in PHP, and I can't seem to get it working correctly.
The script I'm including, basically checks to see if the visitor is logged in, and displays the appropriate template. It's the only vB related code on the page. It worked fine when I was including it into an html page... but when I tried including it into a PHP page, it displayed the follow errors:
Quote:
Warning: Cannot add header information - headers already sent in /usr/local/etc/httpd/htdocs/forums/global.php on line 705
Warning: Cannot add header information - headers already sent in /usr/local/etc/httpd/htdocs/forums/global.php on line 712
I'm not sure what the problem is, since I'm not very familiar with all of the things global.php does when it's required in a script. Perhaps somebody could help me figure this out? Here's the actual script I'm including:
Still struggling with this... I can't figure out why my script is conflicting with global.php. Here is the block of code that's having problems (keep in mind, it works fine when global.php is NOT required in the header of the script):
Code:
$connect=mysql_connect();
$db=mysql_select_db("forum",$connect) or die("Couldn't select database");
$results=mysql_query("SELECT favorites FROM user WHERE userid = '$uid'",$db);
list($favs)=mysql_fetch_row($results);
if ($favs == "") {
Die("You don't have any items in your favorites folder");
}
$favarray = explode("," ,$favs);
$total = count($favarray) - 1;
$db2=mysql_select_db("data",$connect) or die("Couldn't select database");
for ($i = 0; $i <= $total; $i++) {
$lid = $favarray[$i];
$getfavs=mysql_query("SELECT * FROM items WHERE id = '$lid'",$db2);
$result=mysql_fetch_array($getfavs);
I get the "0 is not a mysql result index" error on that last line of that code, where it fetches an array from the database query. Anyone have an idea of what part of that code is conflicting with global.php? Thanks.
-Tom
P.S. I know the code is probably a bit sloppy... I'm new to PHP and MySQL, so I'm still learning. It does work by iteself though