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

Reply
 
Thread Tools Display Modes
  #1  
Old 02-25-2004, 10:53 PM
Mike Cout Mike Cout is offline
 
Join Date: Jan 2003
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default New Row in VB3 DB

Hello,
I am currently working on a hack in which the user has "points". I have written everything out involving the points on a seperate DB and have it working fine. Now I would like to insert a "point" row in for each of my current users and have it work for future users.

Could anyone help me with how I would do this?

-Mike

P.S. I do have phpmyadmin.
Reply With Quote
  #2  
Old 02-25-2004, 10:57 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

[sql]
ALTER TABLE user ADD point INT NOT NULL
[/sql]
Reply With Quote
  #3  
Old 02-25-2004, 11:34 PM
Mike Cout Mike Cout is offline
 
Join Date: Jan 2003
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Now I'm just having trouble selecting the points row.
PHP Code:
$query 'SELECT * FROM `dev_user`';
$result mysql_query($query);
echo 
mysql_result($result); 
What do I need to change to my query to read the value of points?

Thanks!
-Mike
Reply With Quote
  #4  
Old 02-25-2004, 11:40 PM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
mysql_select_db("vbulletin"); 
Reply With Quote
  #5  
Old 02-25-2004, 11:41 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try
PHP Code:
$query 'SELECT point FROM dev_user';
$result mysql_query($query);
echo 
mysql_result($result); 
Reply With Quote
  #6  
Old 02-25-2004, 11:46 PM
Mike Cout Mike Cout is offline
 
Join Date: Jan 2003
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Worked perfectly.

Best Regards,
-Mike
Reply With Quote
  #7  
Old 02-28-2004, 11:57 AM
Mike Cout Mike Cout is offline
 
Join Date: Jan 2003
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Im having trouble writing to a specific user. Any idea on how I would write the points to the database by userid?

I've been trying to use LIMIT but have been unsuccessful.

Thanks,
-Mike
Reply With Quote
  #8  
Old 02-28-2004, 12:06 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

[SQL]
UPDATE dev_user SET point=1234 WHERE userid=4321
[/SQL]

Of course the numbers must be replaced with the actual values
If you just want to increase/decrase the points use SET point=point+value.
Reply With Quote
  #9  
Old 02-28-2004, 01:04 PM
Mike Cout Mike Cout is offline
 
Join Date: Jan 2003
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you!
Reply With Quote
  #10  
Old 03-07-2004, 03:48 PM
Mike Cout Mike Cout is offline
 
Join Date: Jan 2003
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm having trouble getting the users point total to display in the postbit. Could you help me with this?

I was thinking I would add into showthread a way to query the DB using each post's information.

$query = 'SELECT dev_user FROM points WHERE username=post[musername]';

Im not very familar with the way VB does queries and am having trouble understanding it.

-Mike
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 07:29 PM.


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.04862 seconds
  • Memory Usage 2,247KB
  • Queries Executed 11 (?)
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
  • (3)bbcode_php
  • (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_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