Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 08-25-2002, 10:41 PM
Vinney Vinney is offline
 
Join Date: Nov 2001
Posts: 68
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default mysql query.

what is the db query i need to pull the custom user profile fields into a script am making please ?

cheers
Reply With Quote
  #2  
Old 08-25-2002, 11:00 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

if you just want to select all the information, ie userid, fieldx, contents:

[sql]SELECT * FROM userfield;[/sql]
Reply With Quote
  #3  
Old 08-25-2002, 11:01 PM
Vinney Vinney is offline
 
Join Date: Nov 2001
Posts: 68
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by NTLDR
if you just want to select all the information, ie userid, fieldx, contents:

[sql]SELECT * FROM userfield;[/sql]
whats the whole query please ? am a noob ..... i dont know anything about mysql in php.

and what do i use to call the custom user fields of field5 and field9?

would $post[field9] and $post[field5] work in this case.? or is it something else?


thanks.
Reply With Quote
  #4  
Old 08-26-2002, 08:59 PM
Vinney Vinney is offline
 
Join Date: Nov 2001
Posts: 68
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bump
Reply With Quote
  #5  
Old 08-26-2002, 09:04 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by Vinney
[B]whats the whole query please ? am a noob ..... i dont know anything about mysql in php.
That is the whole query.

Quote:
and what do i use to call the custom user fields of field5 and field9?
[sql]SELECT userid,field5,field9 FROM userfield;[/sql]

Quote:
would $post[field9] and $post[field5] work in this case.? or is it something else?
If in the postbit then yes.
Reply With Quote
  #6  
Old 08-26-2002, 09:47 PM
Vinney Vinney is offline
 
Join Date: Nov 2001
Posts: 68
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by NTLDR


That is the whole query.



[sql]SELECT userid,field5,field9 FROM userfield;[/sql]



If in the postbit then yes.
it's not in the postbit, sorry i confused you. am trying to call the userfields for my own script.

PHP Code:
<?php
error_reporting
(7);
require (
'../../mainfile.php');
$index 1;
global 
$Pmenu,$breadcrumb;
$Pmenu="";
$breadcrumb="Contact Helpdesk";
$defaultmessage "Dear Helpdesk... \n\n - $bbuserinfo[username]";
$defaultemail "$bbuserinfo[email]";
$defaultmembership "???????";
$defaultexpiry "??????";
//getvbpvars();
include("header.php");
if (
$bbuserinfo[usergroupid]==||  $bbuserinfo[usergroupid]==|| $bbuserinfo[usergroupid]==|| $bbuserinfo[usergroupid]==11) {
eval(
"dooutput(\"".gettemplate('helpdesk_nologin')."\");"); 
} else {
eval(
"dooutput(\"".gettemplate('helpdesk')."\");");
}
include(
"footer.php");
?>

sorry i dont know the gargon, what $????? ( is it a called a variable ) to define each custom field, so that i can insert this in my template and they will be replaced with the members value when called.?
Reply With Quote
  #7  
Old 08-26-2002, 10:42 PM
Vinney Vinney is offline
 
Join Date: Nov 2001
Posts: 68
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bump.
Reply With Quote
  #8  
Old 08-27-2002, 02:54 PM
NTLDR's Avatar
NTLDR NTLDR is offline
Coder
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 3,644
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by Vinney
bump.
Try to leave it at least one or two days before bumping threads.

PHP Code:
$customfield=$DB_site->query("SELECT field5,field9 FROM userfield WHERE userid='$bbuserinfo[userid]'");
while (
$field=$DB_site->fetch_array($customfield)) {
     
$field5=$feild[5];
     
$feild9=$field[9];
eval(
"\$usercustomfield = \"".gettemplate('template_name')."\";");

Change template_name to the name of the template and create it with whatever formating and place $feild5 in that template for feild 5 and $feild9 in there for feild 9. Then in the main template for the page put in $usercustomfield where you want it to be displayed.
Reply With Quote
  #9  
Old 08-27-2002, 03:42 PM
Vinney Vinney is offline
 
Join Date: Nov 2001
Posts: 68
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Cheers NDLR .....but i cant get it to work, i get this error :

Database error in vBulletin 2.2.6:

Invalid SQL: SELECT field5,field9 WHERE userid='1'
mysql error: You have an error in your SQL syntax near 'WHERE userid='1'' at line 1

mysql error number: 1064

Date: Tuesday 27th of August 2002 05:49:54 PM
Script: http://www.peugeot-gti.net/files/helpdesk/

where do i place your code in the following ? :-

PHP Code:
<?php
<?php
error_reporting
(7);
require (
'../../mainfile.php');
$index 1;
global 
$Pmenu,$breadcrumb;
$Pmenu="";
$breadcrumb="Contact Helpdesk";
$defaultmessage "Dear Helpdesk... \n\n - $bbuserinfo[username]";
$defaultemail "$bbuserinfo[email]";
include(
"header.php");
if (
$bbuserinfo[usergroupid]==||  $bbuserinfo[usergroupid]==|| $bbuserinfo[usergroupid]==|| $bbuserinfo[usergroupid]==11) {
eval(
"dooutput(\"".gettemplate('helpdesk_nologin')."\");"); 
} else {
$customfield=$DB_site->query("SELECT field5,field9 WHERE userid='$bbuserinfo[userid]'");
while (
$field=$DB_site->fetch_array($customfield)) {
     
$field5=$feild[5];
     
$feild9=$field[9];
eval(
"\$usercustomfield = \"".gettemplate('helpdesk')."\";");
}
include(
"footer.php");
}
?>
my helpdesk template contains :

Code:
<table cellpadding="0" cellspacing="0" border="0" bgcolor="#0A293E"  width="95%" align="center"><tr><td>
<table cellpadding="4" cellspacing="1" border="0"  width="100%">
<tr>
<td colspan="2" bgcolor="#336D95" background="https://vborg.vbsupport.ru/images/catagory_backing.gif" align="left"><normalfont color="#000000"><b>
Welcome to PGAC Helpdesk - Follow instructions carefully.</b></normalfont></td>
</tr>
<tr>
<td bgcolor="#13486D" align="left" valign="top">
<p align="center">
<normalfont>Welcome to $bbtitle Helpdesk. </normalfont></p>
<p>
<normalfont>Please take the time to carefully read the following instructions.
This e-mail form has been created, so that forum members can place their questions, or 
queries to a member of our help desk.
Please make sure you fill in all the mandatory fields in.<br><br>
If you have recently just joined the club and have received you membership 
number and renewal date via the post, make sure you have placed them details 
within your
<a target="_blank" href="http://www.peugeot-gti.net/forums/member.php?s=$session[sessionhash]&action=editprofile">
UserCP</a> (<a target="_blank" href="http://www.peugeot-gti.net/forums/member.php?s=$session[sessionhash]&action=editprofile">User Control Panel</a>), and then continue with this.<br>
<br>
-$bbtitle Staff</normalfont></td>
</tr>
</table>
</td></tr></table>
<form enctype="multipart/form-data" action="send.php" name="refer" method="post">
<table cellpadding="0" cellspacing="0" border="0" bgcolor="#0A293E"  width="95%" align="center"><tr><td>
<table cellpadding="4" cellspacing="1" border="0"  width="100%">
<tr>
<td colspan="3" bgcolor="#336D95" background="https://vborg.vbsupport.ru/images/catagory_backing.gif" align="left"><normalfont color="#000000"><b>Contact $bbtitle 
Helpdesk!</b></normalfont></td>
</tr>
<tr>
<td bgcolor="#13486D" align="left" valign="top" nowrap><normalfont>Your 
username:</normalfont></td>
<td bgcolor="#13486D" align="left"><input type="text" name="name" size="30" class="bginput" tabindex="1" value="$bbuserinfo[username]"></td>
<td bgcolor="#13486D" align="left"><b><font color="#FF0000">
*</font></b></td>
</tr>
<tr>
<td bgcolor="#1C5780" align="left" valign="top" nowrap><normalfont>Your email:</normalfont></td>
<td bgcolor="#1C5780" align="left"><input type="text" name="email" size="30" class="bginput" tabindex="1" value="$defaultemail"> </td>
<td bgcolor="#1C5780" align="left"><b>
<font color="#FF0000">*</font></b></td>
</tr>
<tr>
<td bgcolor="#13486D" align="left" valign="top" nowrap><normalfont>Your 
m/ship N</normalfont><normalfont><font face="Times New Roman">?</font></normalfont><normalfont>:</normalfont></td>
<td bgcolor="#13486D" align="left">
<input type="text" name="mem" size="4" class="bginput" tabindex="1" value="$field5"></td>
<td bgcolor="#13486D" align="left"><b><font color="#FF0000">
*</font></b></td>
</tr>
<tr>
<td bgcolor="#1C5780" align="left" valign="top" nowrap><normalfont>Your 
renewal date:</normalfont></td>
<td bgcolor="#1C5780" align="left">
<input type="text" name="expiry" size="8" class="bginput" tabindex="1" value="$field9"> example: 
08/12/02</td>
<td bgcolor="#1C5780" align="left"><b>
<font color="#FF0000">*</font></b></td>
</tr>
<tr>
<td bgcolor="#13486D" align="left" valign="top" nowrap><normalfont>Subject:</normalfont></td>
<td bgcolor="#13486D" align="left">
<normalfont><input type="radio" name="title" value="General Feedback" checked>General Feedback<br>
<input type="radio" name="title" value="Bug Report">Bug Report<br>
<input type="radio" name="title" value="Registration Problem">Registration Problem 
/ Activation request (<b><font color="#FF0000"><u>read above</u></font></b>)<br>
<input type="radio" name="title" value="">Other <input type="text" name="otitle" size="25" class="bginput" tabindex="5">
</normalfont>
</td>
<td bgcolor="#13486D" align="left">
<b><font color="#FF0000">*</font></b></td>
</tr>
<tr>
<td bgcolor="#1C5780" align="left" valign="top" nowrap><normalfont>Your message to us:</normalfont></td>
<td bgcolor="#1C5780" align="left">
<textarea name="message" wrap="virtual" cols="70" rows="15" class="bginput" tabindex="6">$defaultmessage</textarea></td>
<td bgcolor="#1C5780" align="left">
<b><font color="#FF0000">*</font></b></td>
</tr>
</table>
</td></tr></table>
<center>
<b><font color="#FF0000">* </font>= Mandatory field</b><br><br>
<input type="submit" value="Send Email" tabindex="7" accesskey="s" class="bginput"></center>
</form>
Reply With Quote
  #10  
Old 08-27-2002, 03:55 PM
Vinney Vinney is offline
 
Join Date: Nov 2001
Posts: 68
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

what is $usercustomfield there for ?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:02 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.04490 seconds
  • Memory Usage 2,299KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (3)bbcode_php
  • (6)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete