Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives

Reply
 
Thread Tools
Adding fields, need help finishing.... Details »»
Adding fields, need help finishing....
Version: , by SuperG SuperG is offline
Developer Last Online: Feb 2005 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 10-09-2002 Last Update: Never Installs: 0
 
No support by the author.

Ok, I'm needing to add a few fields to New Threads.

This is what I've done thus far:
I've added the fields I need in the thread table in the vb database.

In showthread.php, I added this:
PHP Code:
$trader_price $thread['trader_price'];
    
$trader_shipping $thread['trader_shipping'];
    
$trader_payment $thread['trader_payment'];
    
$trader_man $thread['trader_man'];
    
$trader_trade $thread['trader_trade'];
    
$trader_condition $thread['trader_condition'];
    
$trader_age $thread['trader_age']; 
and added the fields to newthread.php, which would look like this:
PHP Code:
$DB_site->query("INSERT INTO thread (threadid,title,lastpost,forumid,open,replycount,
postusername,postuserid,lastposter,dateline,iconid,
visible,attach,trader_price,trader_shipping,trader_payment,
trader_man,trader_trade,trader_condition,trader_age) VALUES (NULL,'"
.addslashes(htmlspecialchars($subject))."','".time()."','$forumid','1','0','".addslashes($postusername)."',
'
$bbuserinfo[userid]','".addslashes($postusername)."','".time()."','$iconid','$visible','$attachcount','$trader_price','$trader_shipping','$trader_payment','$trader_man','$trader_trade',
'
$trader_condition','$trader_age'"); 

Now, when I submit this stuff, its not writing to the database, so I really don't know if the other parts are working correctly. So, if anyone has any suggestions, please me know. Thanks in advance!

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 10-09-2002, 03:31 AM
SuperG SuperG is offline
 
Join Date: Dec 2001
Location: Cookeville, TN
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks btw
Reply With Quote
  #13  
Old 10-09-2002, 03:37 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The code in your showthread.php is wrong - it is not needed.

What you need to do is add an extra line that does a query on your database to call up those variables in showthread.php (ie. does the opposite of the write query in newthread). You cannot get those variables without a db query unfortunately. Once you have called those variables, you don't need the code you have in the first post for showthread.php.

The $thread['trader_trade'] variable will automatically work in your template - no need to specify it - but you must add a db query first.
Reply With Quote
  #14  
Old 10-09-2002, 03:43 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Something like:

$trader = $DB_site->query_first("SELECT trader_price,trader_shipping,trader_payment,trader _man,trader_trade,trader_condi tion,trader_age FROM thread WHERE XXX");

Replace XXX with whatever condition you want...

Then use the variable $trader[trader_price] in your templates.
Reply With Quote
  #15  
Old 10-09-2002, 05:08 AM
SuperG SuperG is offline
 
Join Date: Dec 2001
Location: Cookeville, TN
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I tried this:
PHP Code:
$trader $DB_site->query_first("SELECT 
trader_price,trader_shipping,trader_payment,trader_man,
trader_trade,trader_condition,trader_age FROM thread WHERE
 threadid = '
$threadid'"); 
BUT, when I try to call it up in the postbit, it just gives me the variables. So, I actually think I'm adding the above in the wrong part of showthread.php, but I'm not really sure where to add it at. Pardon my "newness"...just getting into this stuff.
Reply With Quote
  #16  
Old 10-09-2002, 05:21 AM
SuperG SuperG is offline
 
Join Date: Dec 2001
Location: Cookeville, TN
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm guessing this actually needs to go somewhere in functions.php possibly. Anyone got any ideas?
Reply With Quote
  #17  
Old 10-09-2002, 06:17 AM
Erwin's Avatar
Erwin Erwin is offline
 
Join Date: Jan 2002
Posts: 7,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What do you want it to do???

If you want to display variables in the postbit, yes you need to put that in functions.php. Bear in mind that it will increase your server load by adding 1 query FOR EACH POST in a thread that you show, so if someone is showing a thread with 40 posts, that is 40 EXTRA queries on top of the normal showthread queries.
Reply With Quote
  #18  
Old 10-09-2002, 11:38 AM
SuperG SuperG is offline
 
Join Date: Dec 2001
Location: Cookeville, TN
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm only wanting it to show up on the first postbit, and I'm only calling them in the first postbit. Not sure if that matters.

Well, I entered the code:
PHP Code:
$trader $DB_site->query_first("SELECT trader_price,trader_shipping,trader_payment,trader_man,trader_trade,trader_condition,trader_age FROM thread WHERE threadid = '$threadid'"); 
into the functions.php, but I'm getting and error. So, I must be placing it in the wrong spot or I edited the code above wrong in the condition spot. And help with those parts? Thanks for your help thus far...much appreciated!
Reply With Quote
  #19  
Old 10-09-2002, 11:43 AM
SuperG SuperG is offline
 
Join Date: Dec 2001
Location: Cookeville, TN
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I guess I'm asking which function does this query go under and if have this correct:
PHP Code:
WHERE threadid '$threadid' 
Reply With Quote
  #20  
Old 10-09-2002, 09:45 PM
SuperG SuperG is offline
 
Join Date: Dec 2001
Location: Cookeville, TN
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bumper
Reply With Quote
Reply

Thread Tools

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 09:58 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.05637 seconds
  • Memory Usage 2,296KB
  • Queries Executed 24 (?)
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
  • (5)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)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
  • (9)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_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