The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
troubles including a file
hi all,
I installed vb 2.5 and wanted to include the file last.php in the header of my vb page. The last.php file connects to a different database on my site and retrievs the last 7 records on it. The last.php file looks like: PHP Code:
ob_start(); require("/path/last.php"); $last = ob_get_contents(); ob_end_clean(); this causes a seriuos problem in my forum and error msgs show up even before I put the &last variable in the header!!! I have been trying to figure out what is going on, but failed to fix it. Can anyone plz help me with this?! Any help is apreciated thanx a lot |
#2
|
||||
|
||||
Try changing:
Code:
mysql_close(); Code:
mysql_close($db); |
#3
|
|||
|
|||
I changed the code but still have the error msgs:
There seems to have been a slight problem with the forum database. Please try again by pressing the refresh button in your browser. An E-Mail has been dispatched to our Technical Staff, who you can also contact if the problem persists. We apologise for any inconvenience. Database error in vBulletin 2.2.5: Invalid SQL: SELECT * FROM usergroup WHERE usergroupid=6 mysql error: mysql error number: Date: Wednesday 12th of June 2002 04:27:44 AM Script: http://www.mysite.com/vb Referer: Invalid SQL: UPDATE session SET lastactivity=1023870464,location='/vb/' WHERE sessionhash='050c4ae41a96bb961812d4f6fa57a7bd' mysql error: mysql error number: Date: Wednesday 12th of June 2002 04:27:44 AM Script: http://www.mysite.com/vb Referer: important to mention that I have included some other files and everything wen just fine, I think the problem with the above code. any sugestions? |
#4
|
||||
|
||||
Why dont you run your query in global.php and instead of echoing the result right after the query, compile them with HTML code and assign all to a variable? Then you can insert the variable into header template.
I dont know why your code does not work but this method will work.. |
#5
|
||||
|
||||
Logician: Because he's using a different database, not vBulletin's.
|
#6
|
||||
|
||||
Quote:
His problem may be forgetting to switch back to vb db inside his own code. If his code runs before all other vb code (in the very begining of global.php), I guess it will work.. |
#7
|
||||
|
||||
He doesn't need to switch databases because vBulletin uses the $DB_site class, which specifies a connection ID for each query it issues. He can have 10 other connections open, it doesn't affect vB.
|
#8
|
|||
|
|||
Hi all,
thanx Logician and Firefly, So guys what is wrong? I'm sure it's a correct php code! do you have any idea why it's not working? and how can I try the global.php solution proposed here? thanx |
#9
|
||||
|
||||
I am not sure what your problem is but I know my solution will work (PROVIDED THAT your code is correct).
So what you have to is copy your code in the begining of file yourboard/global.php right AFTER line: PHP Code:
$my_variable.=" <td width=\"20\" bgcolor=\"#F0F0F0\" align=\"center\">"; $my_variable.="<a href=\"$url/index.php?ct=general&md=details&id=$row->idnum\">$row->title</a></font></td>"; etc. then put $my_variable inside any template you like (header for you) If you get "headers already sent error" after modification it means that while editing your code you miss a part which echos a text or sends a piece of information to user, so make sure to remove that part and this will do the trick. |
#10
|
||||
|
||||
im trying to add my advertisement onto my forums
the code is only 2 lines <?php require "ad.php"; echo show_ad(); ?> at first i couldnt figure it out, and i just included the file in the main pages and it would give the header already recieved error i tried adding it to the parsed php, but it has an echo in it, so that doesnt work and when i tried what logician suggested above it gave me an db error. is there any way to do this? thanks |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|