PDA

View Full Version : need help vbulletin/ seperate php script


Vizionz
03-07-2006, 08:16 AM
Stand alone script trying to get stylesheet not working

will call this little code CODE 1
<?
session_start();
require "common.php";
?>

that call will access a file that has this info in it


THIS IS CODE2 Also known as the common.php file
<?php

function connectdbase() {
$db = mysql_connect("localhost", "username", "pass");
mysql_select_db("dataname",$db);
}

?>


This is where i have my problem.. if i put this in the php code with the CODE 1 snippet i end yup with Unable to add cookies, header already sent
So where would this problem becoming from. why would the two conflict

<?
chdir('/home/Forum);
require_once('./global.php');
?><? echo $style['css']; ?>

Marco van Herwaarden
03-07-2006, 08:27 AM
If you really need to set your own head/session/cookies, you could try adding one (or both) of the following lines before your call to global.php:
define('NOHEADER', 1);
define('NOCOOKIES', 1);

Vizionz
03-07-2006, 09:05 AM
thanks marco that was what i needed

ConKien
03-07-2006, 06:07 PM
If you really need to set your own head/session/cookies, you could try adding one (or both) of the following lines before your call to global.php:
define('NOHEADER', 1);
define('NOCOOKIES', 1);


Hi MarcoH64, but if I want to use global.php for VB's cookie to integrate with another app, would the above code disable the vb cookie system?

Thanks for your help!

Vizionz
03-07-2006, 09:55 PM
yeah that disables the vb system so you would want to kill the cookies from the other app instead...

Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource
on line 29

$sql="SELECT * from songlist WHERE ID=$songID"; line 27
$result=mysql_query($sql);line 28
$data=mysql_fetch_object($result);line 29

offhand is there something wrong with that line ? that you can see

ConKien
03-07-2006, 10:02 PM
Thanks Vizionz for the reply!

If the 2 lines above disable the vb system, then why we need to include the global.php? Isn't that the whole purpose of integrate with vb cookies, keep track of the session n stuff?

Vizionz
03-07-2006, 11:56 PM
you dont have to use the two lines he put out i have to because th script i am working on requires to connect to a different database and uses its own individual cookies if you just need to grab the vbulletin info just use everything but them two lines

yeah that disables the vb system so you would want to kill the cookies from the other app instead...


Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource
on line 29

$sql="SELECT * from songlist WHERE ID=$songID"; line 27
$result=mysql_query($sql);line 28
$data=mysql_fetch_object($result);line 29

offhand is there something wrong with that line ? that you can see
anyone ?

Marco van Herwaarden
03-08-2006, 07:01 AM
Do you have a valid DB connection?

Vizionz
03-08-2006, 09:33 AM
i believe so its calling the database connection with the common.php file i posted above

<?
require "common.php";
echo "<body background='$background' bgcolor='$bgcolor' link='$links' alink='$links' vlink='$link'>";
connectdbase();
$sql="SELECT * from songlist WHERE ID=$songID";
$result=mysql_query($sql);
$data=mysql_fetch_object($result);
?>

thats what its doing at the beginning of the script so i dont understand

Vizionz
03-09-2006, 09:44 AM
bump

Adrian Schneider
03-10-2006, 04:15 AM
Whats the error? Try seeing what mysql_error() returns.

Vizionz
03-10-2006, 06:52 AM
how exactly do i put that into the script

echo mysql_errno($link) . ": " . mysql_error($link) . "\n";
?

also having a problem with this.
<?php include("album2.php?artist=" . str_replace(' ', '%20', $song["artist"]) . "); ?>

thats gonna give me a error whats missing

anyone ?

Adrian Schneider
03-10-2006, 03:42 PM
echo mysql_error();
What is your problem with that other line?