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

Reply
 
Thread Tools Display Modes
  #1  
Old 11-05-2002, 02:44 PM
Radon3k's Avatar
Radon3k Radon3k is offline
 
Join Date: Nov 2001
Posts: 245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Question...

Ok I have a page where user's can enter their information and once submitted, it takes them to a page where they can see their information along with everyone else who has submitted information.

I have a seperate admin page that will allow me to edit this info, however, I'm not sure if I want to use the ALTER TABLE command or just UPDATE to change specific information such as this:

Name: John Doe


What if I want to change it so it says "John" only? How do I do that?

Thanks
Reply With Quote
  #2  
Old 11-05-2002, 03:48 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

well, you want to change the field name, so you have to use the update function:

[SQL]UPDATE tablename SET Name='John' WHERE Name='John Doe'[/sql]
Reply With Quote
  #3  
Old 11-05-2002, 04:16 PM
Radon3k's Avatar
Radon3k Radon3k is offline
 
Join Date: Nov 2001
Posts: 245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's what I thought, but I wasn't sure. Thanks!
Reply With Quote
  #4  
Old 11-05-2002, 04:31 PM
Radon3k's Avatar
Radon3k Radon3k is offline
 
Join Date: Nov 2001
Posts: 245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Instead of
PHP Code:
SET Name='John' WHERE Name='John Doe' 
Could you do this instead?
PHP Code:
SET Name='$newname' WHERE Name='$Name' 
?
Reply With Quote
  #5  
Old 11-05-2002, 05:07 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes, it is possible, but you should use this:

PHP Code:
SET Name='".addslashes($newname)."' WHERE Name='".addslashes($Name)."' 
Reply With Quote
  #6  
Old 11-05-2002, 05:12 PM
Radon3k's Avatar
Radon3k Radon3k is offline
 
Join Date: Nov 2001
Posts: 245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, thanks. Now the problem is that the variable $Name isn't declared in this PHP file, it's declared in another one. How do I make it to where it still works?

Thanks for the help, sir!
Reply With Quote
  #7  
Old 11-05-2002, 05:14 PM
Radon3k's Avatar
Radon3k Radon3k is offline
 
Join Date: Nov 2001
Posts: 245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Btw, does this look right?
PHP Code:
if ($submitnewname == "Submit") {
    
$sql "UPDATE yp SET Name='"./($newname)."' WHERE Name='"./($Name)."'"
Reply With Quote
  #8  
Old 11-05-2002, 07:26 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

first question: hmm, if you include the file it would work, or you can call the script with a command line variable:
script.php?name=blabla

if you call the script through an inputform use this in the form:
<input type="hidden" name="name" value="which name....">

and no, this would be correct:
PHP Code:
if ($submitnewname == "Submit") {
    
$sql "UPDATE yp SET Name='".addslashes($newname)."' WHERE Name='".addslashes($Name)."'"
the function is called addslashes
Reply With Quote
  #9  
Old 11-05-2002, 07:41 PM
Radon3k's Avatar
Radon3k Radon3k is offline
 
Join Date: Nov 2001
Posts: 245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok I don't understand what you were saying about my first question (regarding how the variable isn't in this particular script).

As of right now I'm using the require() function, and don't see the difference between require() and include().

Don't understand the point of something like "script.php?name=blabla" or how it would be used in context to what I'm working with. The hidden input also confuses me.

Sorry, I'm still learning this stuff, doing the best I can, I appreciate all of your help, sir!
Reply With Quote
  #10  
Old 11-05-2002, 07:45 PM
Radon3k's Avatar
Radon3k Radon3k is offline
 
Join Date: Nov 2001
Posts: 245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok well I've got problems galore, allow me to show you the actual page I'm working on. http://radon3k.bbadmins.com/index.php is the main page, there's a link to the second page, and http://radon3k.bbadmins.com/admin.php is where I'd edit the information.

Here's the problem:

I want to edit a specific user name, so if let's say I wanted to change Ryan to Radon3k, how do I do this? I have the general idea, but my code is saying "change all the current names to the name I just typed into the admin name change box".

Does this make sense or am I just confusing myself and everyone else?
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 02:39 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.04728 seconds
  • Memory Usage 2,259KB
  • 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
  • (5)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