Solved

this query is not working , is it right?

Posted on 2009-07-15
9
222 Views
Last Modified: 2012-05-07
$sql="alter table `$tname` change `$old_field_name` `$field_name1` , `$old_field_type` `$dropdown` ";
0
Comment
Question by:designersx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
9 Comments
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 24866536
which database you are using

if it is sql then syntax must be

$sql="alter table `$tname` set `$old_field_name`= `$field_name1` , `$old_field_type`= `$dropdown` ";
0
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 50 total points
ID: 24866544
sorry for last post...........
check this syatax

alter table [table name] change [old column name] [new column name] varchar (50);

I think you need to give the datatype also
0
 

Author Comment

by:designersx
ID: 24866594
i am using mysql database and php.

i want to write the query for 2 fields.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:designersx
ID: 24866654
i wrote this query in mysql database to check if it runs but it does not runs.
0
 

Author Comment

by:designersx
ID: 24866666
alter table contact set `email` `email12` //not working

alter table contact set `email` `email12`  varchar (255);  //not working
0
 

Author Comment

by:designersx
ID: 24866671
if i use change then query does not works.
0
 

Author Comment

by:designersx
ID: 24866685
sir please tell me it is not working
0
 
LVL 4

Expert Comment

by:termlimit
ID: 24866694
ALTER TABLE `table_name` CHANGE `old_column` `new_colum` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'

You might have an issue with some of the variables you are trying to add into the query.  Echo the query to the screen to make sure and try it manually.
0
 

Author Closing Comment

by:designersx
ID: 31604112
yes it worked.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question