The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
Hi,
This should be easy but I'm not sure where to go from here. I made a "search.php" file that queries a mySQL db and I want the result to be shown in a VB template. So, I have succesfully duplicated the vb template: (I won't show all the code b/c you all know what it looks like, but for reference it's this I'm talking about) : PHP Code:
After the above code, I connect to the database and run a query. I have the results stored in a recordset like this: PHP Code:
How do I store that into some vb variable so I can access it in the HTML template later? Something like this? $array= construct_navbits($array); Thanks. |
#2
|
||||
|
||||
![]()
No, you'll do like this
Code:
$myarray = get_ranges("..."); Although if you're using the vBulletin database, there's a better way of executing the query than what you're using... |
#3
|
||||
|
||||
![]()
You want to use the vBulletin database class instead (as it also does MySQLi).
PHP Code:
|
#4
|
|||
|
|||
![]()
Thank you both.
Dismounted: quick question. I'm not trying to trick you into writing the code for me, but I need a bit of help, please. My query is fine, but if you'd like to see it here it is: PHP Code:
PHP Code:
Thank you. |
#5
|
||||
|
||||
![]()
Man you weren't kidding when you said "noobie". You've got it backwards. Your query could be improved too...
PHP Code:
Alternatively... PHP Code:
|
#6
|
||||
|
||||
![]() PHP Code:
|
#7
|
||||
|
||||
![]()
Dismounted, do you really think that $state is a user inputted variable?
|
#8
|
||||
|
||||
![]()
User-input or not, it needs to be cleaned beforehand.
Hypothetical: Assume it was added by Admins through the Admin CP. Unknowing Admin uses single quotes. Bam! Your query fails. |
#9
|
||||
|
||||
![]()
True, but this guy is making a $query variable instead of inlining the string. I think he's done the same thing with something in the $state variable.
But I guess it's better to be safe than sorry. ![]() |
#10
|
|||
|
|||
![]()
Hi guys,
Well, my SQL is fine since I actually did sql injection prevention before the query..but in regards to the other codes, they are causing the php page to turn blank, which means there is an error... Tiger: I think the reason why yours is doing it is because you can't echo within the php file, since its meant to display the template. Dismounted: I'm not sure why yours isn't working either. ...still grateful for the help so far!! |
![]() |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|