![]() |
Resource ID #18
Hello -
I've been following this tutorial here: https://vborg.vbsupport.ru/showthread.php?t=119350 I've been trying to access the database via this code: Code:
$mytest = $db->query_read("SELECT state_name FROM vb_sidemenu_states WHERE state_id=1"); Code:
Resource id #18 Code:
$mytest = $vbulletin->db->query_read("SELECT state_name FROM vb_sidemenu_states WHERE state_id=1"); The above selected table is in the vb database |
query_read returns a resource variable, hence what you are getting.
Use query_first instead of query_read when you are selecting only one row. (In future cases you need to iterate through $db->fetch_array() with the resource returned from query_read) |
Thanks for the reply.
I am having some issue with the syntax of this. My goal is to display a list of items as a side menu. Where is my error in the following code? I am confused on where exactly to query and the pull it into an array. Thanks BTW... Code:
$getstate = $db->query_read("SELECT state_name FROM vb_sidemenu_states"); |
What do you want to do with the data, inside the loop you can access state_name via:
PHP Code:
|
Quote:
|
I eventually want to pull the state_name and state_link. Format the data as a menu and assign it to a variable so I can drop it into a template.
--------------- Added [DATE]1193673468[/DATE] at [TIME]1193673468[/TIME] --------------- Quote:
After reading the code again I did realize that I had the $results and $getstate flipped. I will try out this newly-founded knowledge and see if I can get it to work. If I can...this will be great! --------------- Added [DATE]1193676153[/DATE] at [TIME]1193676153[/TIME] --------------- Thank you very much, I now understand how to do this and it's runnin' just like I want! |
All times are GMT. The time now is 10:25 AM. |
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:
|