![]() |
Vbulletin database connection
Hi, until now i never connected to the vbulletin database i know how to connect to mysql, that's the general code
PHP Code:
I hope i made myself clear thanks in advance, Scanu. |
If you're including global.php in the script (or if it's a plugin), then you can just use $vbulletin->db->query_read() (or one of the other query functions).
If you have a separate script and you don't want to include global.php, then I think I'd include config.php and use the config variables from there in mysql calls, like you posted above. You can look in includes/class_core.php, the class vB_Database code that starts around line 83, to see how vbulletin uses the config variables. Edit: if this is for a mod you're planning to release, I think it's a much better idea to find a way to use the vb code so that you don't have to worry about the database configuration. |
mysql_query() = $vbulletin->db->query
mysql_fetch_row() = $vbulletin->db->fetch_row mysql_fetch_assoc() = $vbulletin->db->fetch_assoc mysql_fetch_object() = $vbulletin->db->fetch_object Just like this? |
Quote:
Also, remember that if you use any strings that you're getting from the outside world in one of your queries, put it through escape_string() first. |
All times are GMT. The time now is 09:07 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|