Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 05-31-2003, 10:59 PM
gengar003's Avatar
gengar003 gengar003 is offline
 
Join Date: Apr 2002
Location: .::|The Matrix|::.
Posts: 181
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
05-27-03 at 02:46 AM filburt1 said this in Post #2
TINYINT is a datatype like long, int, String, etc.
NULL means literally "nothing."

[sql]
ALTER TABLE user ADD yourfield TINYINT(1) NOT NULL DEFAULT 0;
[/sql]

I'm trying to run that query, but I get this error:

Error

SQL-query :
[sql]

ALTER TABLE user ADD yourfield TINYINT( 1 ) NOT NULL DEFAULT0
[/sql]
MySQL said:


You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT0' at line 1
Reply With Quote
  #12  
Old 05-31-2003, 11:24 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need a space between DEFAULT and 0.

And TINYINT( 1 ) should be TINYINT(1).
Reply With Quote
  #13  
Old 05-31-2003, 11:30 PM
gengar003's Avatar
gengar003 gengar003 is offline
 
Join Date: Apr 2002
Location: .::|The Matrix|::.
Posts: 181
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, it's like that when I enter it in, but afterwards, it messes it up...

Anyway, I added in some quotes, and it worked.

Reply With Quote
  #14  
Old 05-31-2003, 11:35 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Today at 08:24 PM Boofo said this in Post #12
You need a space between DEFAULT and 0.

And TINYINT( 1 ) should be TINYINT(1).
Whitespace doesn't matter.
Reply With Quote
  #15  
Old 06-01-2003, 02:18 PM
gengar003's Avatar
gengar003 gengar003 is offline
 
Join Date: Apr 2002
Location: .::|The Matrix|::.
Posts: 181
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nother question:

HOw would I add in a field to store large amounts of text (10,000 chars) ?

With default 'None'

? I tried, but it just gave me syntax errors...

EDIT: Also, once that was done, how would I set it up so that I could do $post['thatfield'] and have it show the poster's data for that field in the postbit?
Reply With Quote
  #16  
Old 06-01-2003, 08:37 PM
Gary King's Avatar
Gary King Gary King is offline
 
Join Date: Jan 2002
Posts: 2,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Today at 11:18 AM gengar003 said this in Post #15
nother question:

HOw would I add in a field to store large amounts of text (10,000 chars) ?

With default 'None'

? I tried, but it just gave me syntax errors...

EDIT: Also, once that was done, how would I set it up so that I could do $post['thatfield'] and have it show the poster's data for that field in the postbit?
Answer #1:

[sql]ALTER TABLE `tbl_name` ADD `col_name` TEXT;[/sql]

For default, do you actually want the default to be the string: 'None' , or NULL (nothing there)?

Answer #2:

PHP Code:
$bbuserinfo[col_name
Reply With Quote
  #17  
Old 06-01-2003, 08:44 PM
gengar003's Avatar
gengar003 gengar003 is offline
 
Join Date: Apr 2002
Location: .::|The Matrix|::.
Posts: 181
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Umm, yeah, the string "none" I would replace TEXT with that?

Also, I want to be able to use $post[col_name] and have it display the info for $post[username]...

get what I'm saying?
Reply With Quote
  #18  
Old 06-01-2003, 08:50 PM
Gary King's Avatar
Gary King Gary King is offline
 
Join Date: Jan 2002
Posts: 2,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For the query, just use the one I gave, but replacing the tbl_name and col_name of course. TEXT means that it will contain text, to a maximum of 65535 characters.

Just like what I said at Answer #2; place the variable in the postbit wherever you want to display it.
Reply With Quote
  #19  
Old 06-01-2003, 09:40 PM
gengar003's Avatar
gengar003 gengar003 is offline
 
Join Date: Apr 2002
Location: .::|The Matrix|::.
Posts: 181
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

but, wouldnt' that make the person who's viewing the post see their own info there, instead of the poster's?
Reply With Quote
  #20  
Old 06-01-2003, 09:56 PM
Gary King's Avatar
Gary King Gary King is offline
 
Join Date: Jan 2002
Posts: 2,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My mistake, it's $post[col_name].
Reply With Quote
Reply


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 01:12 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04049 seconds
  • Memory Usage 2,260KB
  • 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_php
  • (3)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
  • (2)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