The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How to use query result in same php file
I have this query
Code:
$ytvideo = $db->query_read("SELECT threadid FROM thread WHERE ytvideo = '$id'"); if($row = $db->fetch_array($ytvideo)) { $ytvideoid = $row[threadid]; } Thanks |
#2
|
||||
|
||||
That's what the plugin system is for. You can use plugin hooks to call code like that from the PHP files. Open the .PHP file you want to include it in, and find a hook location for it.
|
#3
|
|||
|
|||
The php file I'm working in isn't a vbulletin file. It's a project I'm working on integrated with vb. I just want to figure out how to use $ytvideoid from the code above in the file rather than in the template. Using it in the file right now it has no value, but in the template it has the correct value...
|
#4
|
||||
|
||||
Then I would say the reason the variable doesn't have any value is because the variable $id isn't defined in your PHP file. You'll want to try to find a different variable for it, because that's probably defined by whatever's calling the template.
Next, your select statement isn't cool, you should do this: Code:
"SELECT threadid FROM ".TABLE_PREFIX."thread WHERE |
#5
|
||||
|
||||
PHP Code:
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|