Solved

this query is not working , is it right?

Posted on 2009-07-15
9
219 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
  • 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to count in a table in php 22 33
Advice and best practice  SQLite3 Database using PHP 2 47
tutorial for ebay api 3 32
Google Maps API and PHP 25 27
This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

786 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