vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   ...More mySQL Questions - How do I... (https://vborg.vbsupport.ru/showthread.php?t=54460)

gengar003 06-17-2003 11:16 PM

...More mySQL Questions - How do I...
 
... How do I change the name of a field in a table, say, from "likescheese" to "likesmilk" ?

Gary King 06-17-2003 11:29 PM

[sql]ALTER TABLE tbl_name CHANGE old_field new_field[/sql]

gengar003 06-17-2003 11:50 PM

Another question:

in
PHP Code:

$keeparray $DB_site->query("SELECT 'name','catchname','data' FROM tacemonquery WHERE name='$th_old_name'"); 

I'd reference "name", "catchname" and "data" by

$keeparray['name'] or $keeparray[name], right? Because it's not working, Maybe something's wrong with the query....

Help?

also, this:

PHP Code:

$DB_site->query("ALTER TABLE user CHANGE '$keeparray[catchname]', '$th_rong_name'"); 

Returns an error, PRESUMABLY because the two variables, both of which are set based on the keeparray mentioned above, are assigned no value... That aside, is the syntax right to change user field $keeparray[catchname] to $th_rong_name ?

filburt1 06-17-2003 11:57 PM

$keeparray['name'], only.

Second question:
PHP Code:

$DB_site->query("ALTER TABLE user CHANGE " $keeparray['catchname'] . $th_rong_name"); 

...assuming, of course, that $keeparay['catchname'] and $th_rong_name contain valid column names.

gengar003 06-18-2003 12:09 AM

Heh, thanx, it works now, It turns out that I needed to remove some quotes, since.......



anyway, it works now.

:)

Once again, filburt saves the daY!


All times are GMT. The time now is 06:21 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.01213 seconds
  • Memory Usage 1,719KB
  • 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
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete