vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   getting info from a db table? (https://vborg.vbsupport.ru/showthread.php?t=37391)

Neo 04-13-2002 11:17 PM

getting info from a db table?
 
How would I go about getting infomation like the way you can with $bbuserinfo. But with another table?

mr e 04-14-2002 05:24 AM

Well the way I do it is go into PHPMyAdmin and look at the different tables and see which one has the info you want the do

$variable=$DB_site->query_first("SELECT * FROM INSERTTABLEHERE");

Neo 04-14-2002 05:28 AM

Ummmm... I know how to do that what I want to be able to do is call information like the $bbuserinfo does.

examples:
$bbuserinfo[username]
$bbuserinfo[userid]

and so no but with a different table

DjSap 04-14-2002 06:32 AM

well the bbuserinfo query is in session.php, i don't really understand what you are trying to do...if you want to grab extra info to $bbuserinfo from another table then just add ,tablename.* to the query....but if you want to grab a totaly diffrent table that isn't based on userid then you prolly would be better off making a function.

Neo 04-14-2002 06:54 AM

Umm.. there are ways of doing it without having to make another function... I guess I will have to get off my lazy ass site down and do it. ;)

Reeve of shinra 04-14-2002 07:39 AM

If you have a variable pulling multiple information from a table, then you can use the variable name with the field name in brackets to have it displayed.

ex:

$myvar query_first("field1, field2, field3");

$myvar[field1]
$myvar[field2]
$myvar[field3]

Or something like that,... I think you catch on to my horribly bad explaination here =P

Neo 04-14-2002 09:50 PM

Thanks Reeve, but I figured it out after sobering up :)

Neo 04-15-2002 01:29 PM

PHP Code:

$result=$DB_site->query("SELECT * FROM user WHERE userid='1'");
$userinfo=mysql_fetch_array($result); 


Admin 04-15-2002 01:36 PM

Quote:

Originally posted by neo
PHP Code:

$result=$DB_site->query("SELECT * FROM user WHERE userid='1'");
$userinfo=mysql_fetch_array($result); 


Or just
Code:

$userinfo = $DB_site->query_first("SELECT * FROM user WHERE userid=1");


All times are GMT. The time now is 07:33 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
  • Page Generation 0.01017 seconds
  • Memory Usage 1,726KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete