PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Try It Free
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old July 24th, 2002, 10:46 PM
mhoward mhoward is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: UK
Posts: 49 mhoward User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
renaming ,mysql table in php

I am trying to use my PHP script to rename a database table. I thought this would be the easiest part of my script, but I seem to be having a problem.

The script is
mysql_connect("$userdbhost", "$userdbuser", "$userdbpass")
or die ("Unable to connect to your database, please conact support@2techsolutions.com");
mysql_select_db("$userdbase") or die("Could not select database");

$renquery = "RENAME TABLE $tablelist TO $new_tbl_name";

$renresult = mysql_query($renquery);

if (!$renresult) {

$usrmsg = "<p align="left">Unable to rename your table from <b>$tablelist</b> to <b>$new_tbl_name</b>. Please contact<a href="mailto:support@2techsolutions.com" class="mainboxfont">support@2techsolutions.com</a>
for further assistance.</p>n";
}

// Do other stuff

Any ideas? I am just getting the message telling me to contact support etc...

Reply With Quote
  #2  
Old July 25th, 2002, 02:51 AM
siteworkspro.com siteworkspro.com is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Sydney, Australia
Posts: 92 siteworkspro.com User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to siteworkspro.com Send a message via AIM to siteworkspro.com
RE: renaming ,mysql table in php

change your query to

ALTER TABLE `$tablelist` RENAME `$new_tbl_name`

Reply With Quote
  #3  
Old July 25th, 2002, 08:01 PM
mhoward mhoward is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: UK
Posts: 49 mhoward User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: renaming ,mysql table in php

I had to remove the quotes before it worked - thanks.


Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > renaming ,mysql table in php


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway