vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Custom Profile Fields SQL... (https://vborg.vbsupport.ru/showthread.php?t=157432)

masterwebguy 09-09-2007 07:21 PM

Custom Profile Fields SQL...
 
I am trying to get a custom profile field 'field5' read from the database by MY php script.

I can get the username by IP, but I don't know how to get the custom profile field.

e.g.
PHP Code:

<?
include("database.php");
$var = $_SERVER['REMOTE_ADDR'];
$set=mysql_query("SELECT * FROM user WHERE ipaddress='$var'");
while($row = mysql_fetch_array($set))
 {
$username = $row['username'];
 }

echo $username; //It's here for a specific reason but that's off the point
?>

How do I do this for field5???

Thanks.

Joshie787 09-09-2007 08:35 PM

PHP Code:

 <? 
connectTOforum();

$query = mysql_query("SELECT * from user ORDER BY posts DESC LIMIT 0, 5");
while($row = mysql_fetch_array($query)){ 

       $query2 = mysql_query("SELECT * from userfield WHERE userid='$row[userid]' ORDER BY field5 DESC LIMIT 5");
    $info3  = mysql_fetch_array($query2); ?>
    
  <li><? echo($row['username']); ?> - <? echo($info3['field5']); ?></a></li>
                        <? } ?>

That's what I have on my website, and it displays, I hope it helps, replace what needs to be replaced to display it from the ip address?

masterwebguy 09-09-2007 10:17 PM

Thanks. I was able to figure out how to make my own code from that.

Here it is:
PHP Code:

include("database.php"); //Database connection file
$va =$_SERVER['REMOTE_ADDR'];
$set=mysql_query("SELECT * FROM user WHERE ipaddress='$var'");
while(
$row=mysql_fetch_array($set))
 {
$username=$row['username'];
$userid=$row['userid'];
 }
$query1=mysql_query("SELECT * from userfield WHERE userid='$userid'");
while (
$id=mysql_fetch_array($query1))
{
$bnaccount=$id['field5'];



Joshie787 09-10-2007 01:27 AM

Cool, so I was somewhat helpful :P


All times are GMT. The time now is 02:29 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
  • Page Generation 0.01096 seconds
  • Memory Usage 1,720KB
  • 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
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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