Current location: Hot Scripts Forums » Programming Languages » PHP » updating database tables when tables may or may not have changed?

updating database tables when tables may or may not have changed?

 
Prev Previous Post   Next Post Next
  #1  
Old 05-21-06, 06:25 PM
Tim Mousel Tim Mousel is offline
Wannabe Coder
 
Join Date: Jan 2005
Posts: 155
Thanks: 0
Thanked 0 Times in 0 Posts
Question updating database tables when tables may or may not have changed?

I have an update script for a script I wrote. Users will need to run the update script to add new tables and to alter tables.

Currently my install script pulls all of the create table statements from an sql file and creates the tables.

What is the best way to detect which tables are present and which are present but need to be altered?

I'm currently using this but that doesn't take care of adding alter statements:
PHP Code:
if(!sql_result3)
{
if(
mysql_errno() == 1062)
{
$errors[] = 'Duplicate entry, proceeding to next record...<br />';
}
if(
mysql_errno() == 1060)
{
$errors[] = 'Duplicate column entry, proceeding to next record...<br />';
}

else {
die(
sprintf("Couldn't execute query, %s: %s"db_errno(), db_error()));

}

Thanks,

Tim
Reply With Quote
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
can i things into 2 tables in the same database on 1 script? tisza PHP 3 07-01-04 05:11 AM
i have a problem regarding updating database online GENIUSAdnan PHP 1 06-23-04 04:53 AM
question about updating a page or database for an, php and mysql updating mikewooten PHP 1 02-12-04 01:11 AM
updating tables problem concatenate_man PHP 5 12-27-03 08:59 PM


All times are GMT -5. The time now is 02:34 AM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2 (Unregistered)