Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

this query is not working , is it right?

Posted on 2009-07-15
9
Medium Priority
?
225 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 200 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
Technology Partners: 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

604 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