vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Question... (https://vborg.vbsupport.ru/showthread.php?t=45417)

Radon3k 11-05-2002 02:44 PM

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 :)

Xenon 11-05-2002 03:48 PM

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]

Radon3k 11-05-2002 04:16 PM

That's what I thought, but I wasn't sure. Thanks! :)

Radon3k 11-05-2002 04:31 PM

Instead of
PHP Code:

SET Name='John' WHERE Name='John Doe' 

Could you do this instead?
PHP Code:

SET Name='$newname' WHERE Name='$Name' 

?

Xenon 11-05-2002 05:07 PM

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

PHP Code:

SET Name='".addslashes($newname)."' WHERE Name='".addslashes($Name)."' 


Radon3k 11-05-2002 05:12 PM

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! :)

Radon3k 11-05-2002 05:14 PM

Btw, does this look right?
PHP Code:

if ($submitnewname == "Submit") {
    
$sql "UPDATE yp SET Name='"./($newname)."' WHERE Name='"./($Name)."'"


Xenon 11-05-2002 07:26 PM

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 ;)

Radon3k 11-05-2002 07:41 PM

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! :)

Radon3k 11-05-2002 07:45 PM

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?


All times are GMT. The time now is 01:17 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.01943 seconds
  • Memory Usage 1,735KB
  • 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