PDA

View Full Version : How do I call information from a field that I have added in userfield table?


huge
11-24-2001, 07:24 AM
In the forumhome template of VB 2.2.1

I would like the text to read as follows in the browser:
"Welcome to our newest member Mike , from U of Montreal."

geting it's information as follows:
"Welcome to our newest member <$newusername>, from <field9 of userfields table>."

Here is the template code where this should be inserted:
Welcome to our newest member, <a href="member.php?s=$session[sessionhash]&action=getinfo&userid=$newuserid"><b>$newusername</b></a>.

Thank you for helping me out, I have been able to make all other modifications that I needed in the postbit but I cannot figure out how to call up the information here in forumhome.

Admin
11-24-2001, 07:34 AM
In index.php, replace this:
// get newest member
$getnewestusers=$DB_site->query_first("SELECT userid,username FROM user WHERE userid=$numbersmembers[max]");
$newusername=$getnewestusers['username'];
$newuserid=$getnewestusers['userid'];
with this:
// get newest member
$getnewestusers=$DB_site->query_first("SELECT userid,username,field9 FROM user LEFT JOIN userfield USING (userid) WHERE user.userid=$numbersmembers[max]");
$newusername=$getnewestusers['username'];
$newuserid=$getnewestusers['userid'];
$newuserlocation=$getnewestusers[field9];

Now use $newuserlocation to show that field in the forumhome template.

huge
11-25-2001, 06:01 AM
Firefly,

Thanks for posting a response so quickly, I really appreciate you helping me, unfortunately it did not work.

Here is the email error message that I get when I modify index.php as you suggested:

--------------
Database error in vBulletin 2.2.1:

Invalid SQL: SELECT userid,username,field9 FROM user LEFT JOIN userfield USING (userid) WHERE user.userid=4
mysql error: Column: 'userid' in field list is ambiguous

mysql error number: 1052

Date: Sunday 25th of November 2001 12:29:12 AM
Script: http://www.dentist2b.com/bb/bb/
Referer:
--------------

This is what my userfield table looks like from phpMyAdmin, although I really do not know if this will help you at all:

Database dentist2_forum - table userfield
Field Type Attributes Null Default Extra
userid int(10) UNSIGNED No 0
field6 char(250) No
field7 char(250) No
field8 char(250) No
field9 char(250) No


Indexes : Keyname Unique Fulltext Field
PRIMARY Yes No userid


Space usage : Type Usage
Data 4,020 Bytes
Index 2,048 Bytes
Total 6,068 Bytes
Row Statistic : Statements Value
Format fixed
Rows 4
Row length ? 1,005
Row size ? 1,517 Bytes

Thanks.

Admin
11-25-2001, 11:24 AM
Sorry, my bad.
I forgot to specify the table before the userid field:
// get newest member
$getnewestusers=$DB_site->query_first("SELECT user.userid,username,field9 FROM user LEFT JOIN userfield USING (userid) WHERE user.userid=$numbersmembers[max]");
$newusername=$getnewestusers['username'];
$newuserid=$getnewestusers['userid'];
$newuserlocation=$getnewestusers[field9];

huge
11-26-2001, 03:19 AM
Thanks Firefly :D

You have been very helpful, everything works perfectly now.

much appreciated!!