vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Adding fields, need help finishing.... (https://vborg.vbsupport.ru/showthread.php?t=44429)

SuperG 10-09-2002 01:12 AM

Adding fields, need help finishing....
 
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!

SuperG 10-09-2002 01:20 AM

UPDATE:
I get this error:
PHP Code:

Database error in vBulletin 2.2.7:

Invalid SQLINSERT 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_ageVALUES (NULL,'You can\'t see this either','1034129905','14','1','0','SuperG','1','SuperG','1034129905','1','1','1','1200.00','00.00','Check','WDP','Yes','Brand New','1-3 Months'
mysql errorYou have an error in your SQL syntax near '' at line 1

mysql error number
1064

Date
Tuesday 08th of October 2002 08:18:25 PM
Script
: [url]http://www.southernpaintball.com/forums/forums/newthread.php[/url]
Referer: [url]http://www.southernpaintball.com/forums/newthread.php?action=newthread&forumid=14[/url] 


Erwin 10-09-2002 02:00 AM

Easy fix:

Change this:

'You can't see this either'

To this:

'You cannot see this either'

You had 2 ' symbols in the wrong place! :)

You cannot use "can't" because the ' symbol conflicts with the query line.

SuperG 10-09-2002 02:10 AM

ok then, that was the subject of the post so it shouldn't matter, i mean, regular posts have apostrophe's in them.

Any other suggestions?

Erwin 10-09-2002 02:18 AM

I know regular posts have apostrophe's in them, but you are putting that in a query - each query variable has a ' around them to delineate them, but you have a ' inside 2 ' within a variable which will cause a mysql syntax error. PHP thinks your variable is 'You can' because the ' in can't has ended that variable, but there is no comma so the syntax error occurs.

Erwin 10-09-2002 02:18 AM

Just make the changes, and the syntax error should be resolved.

SuperG 10-09-2002 02:27 AM

lemme try dat..i'll post again.....

SuperG 10-09-2002 02:39 AM

I went back to the original newthread.php file and everything worked. THAT has the subject in it, so its not what you suggested. I added my other values back, and it again does not work. So, its something with the new stuff I'm adding which, but I can't find a problem with it. Any other suggestions?

Erwin 10-09-2002 02:52 AM

Ahhh... I see what you mean... you're right... I thought you had that statement in a query in a PHP file... :) Should have read your posts better...

Try this:

Find:

PHP Code:

'$trader_age'"); 

Change to:

PHP Code:

'$trader_age')"); 

I think you may be missing a bracket ) symbol there. :)

SuperG 10-09-2002 03:06 AM

Ok, that fixed the problem with writing it to the database.

Now, with what I have posted above, its not calling it up from the database. Any suggestions there?


All times are GMT. The time now is 12:35 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.01138 seconds
  • Memory Usage 1,751KB
  • 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
  • (5)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete