Re: Foreign Key Preventing Publishing to Web?
hi, in the script you have " CONSTRAINT `0_132` FOREIGN KEY ( `SCode` ) REFERENCES `statesarticles` ( `SCode` ) ON UPDATE CASCADE " and this code it's a definition of the foreign key. run the script without this part of the code. Citando David Blomstrom <[EMAIL PROTECTED]>: > When I was first learning to work with MySQL, I > discovered that I couldn't publish my databases to the > Internet if they had foreign keys. So I stripped out > all the foreign keys and got them online. > > I'm not trying to publish a table I haven't worked > with in a while, but I just get error messages. The > error message suggests it's a foreign key problem; at > the very least, it suggests the table has a foreign > key. But I can't remember how to even tell if a > foreign key is present. When I look at my table in > PPHPmyadmin, I just see one key - a primary key - > under Keyname. > > When I click on SCode - the field that supposedly has > the foreign key, I see no reference to a foreign key. > > I pasted the error message below. Can someone tell me > what I'm missing? > > Thanks. > > SQL-query: > > # phpMyAdmin SQL Dump > # version 2.5.3 > # http://www.phpmyadmin.net > # > # Host: localhost > # Generation Time: Aug 17, 2004 at 08:52 AM > # Server version: 4.0.16 > # PHP Version: 4.3.4 > # > # Database : `world` > # > # > > # > # Table structure for table `counties` > # > CREATE TABLE `counties` ( > `SCode` varchar( 6 ) NOT NULL default '', > `NameC` varchar( 255 ) default NULL , > `TypeC` varchar( 255 ) default NULL , > `Seat` varchar( 255 ) default NULL , > `Area_MI` decimal( 10, 1 ) default NULL , > `Area_KM` decimal( 10, 1 ) default NULL , > `Pop_2000` int( 10 ) default NULL , > `Pop_1990` int( 10 ) default NULL , > `Pop_MI` decimal( 10, 1 ) default NULL , > `Pop_KM` decimal( 10, 1 ) default NULL , > `Race1` int( 10 ) default NULL , > `Race2` int( 10 ) default NULL , > `Amerindian` int( 10 ) default NULL , > `White` int( 10 ) default NULL , > `Black` int( 10 ) default NULL , > `Asian` int( 10 ) default NULL , > `Pacific_Island` int( 6 ) default NULL , > `Some_Other_Race` int( 10 ) default NULL , > `Hispanic` int( 10 ) default NULL , > `id` int( 6 ) NOT NULL AUTO_INCREMENT , > PRIMARY KEY ( `id` ) , > KEY `SCode` ( `SCode` ) , > CONSTRAINT `0_132` FOREIGN KEY ( `SCode` ) REFERENCES > `statesarticles` ( `SCode` ) ON UPDATE CASCADE > ) TYPE = InnoDB PACK_KEYS =0 AUTO_INCREMENT =3143 > > MySQL said: Documentation > #1005 - Can't create table > './world_gypsy/counties.frm' (errno: 150) > > > > __ > Do you Yahoo!? > All your favorites on one personal page Try My Yahoo! > http://my.yahoo.com > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] > > Ganha Câmaras de Filmar, Televisões e outros fantásticos prémios Samsung com o SAPO! Clica em http://dc.sapo.pt/sfc -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Best practise roll-backs?
Hi, before you start to make inserts/updates to the database you can put $db->query("begin;") -> this is to begin a transaction, in the end of the script you put commit ($db->query("commit;") if all goes ok, otherwise rollback ($db->query("rollback;"). andré brás Citando Andy Hall <[EMAIL PROTECTED]>: > Hi, > > I have a PHP script that is running 4 queries. If the 4th fails, ideally I > would like the other 3 queires to roll back and leave the database as if they > were never run at all. > > Can anyone advise on any technique that would do this easily, as opposed to > manually writing and running queries to set the database back (which would be > messy IMO). > > This project is being developed on MySQL 3.23.37. > > Any help is appreciated, thanks. > > Andy Hall. > O SAPO já está livre de vírus com a Panda Software, fique você também! Clique em: http://antivirus.sapo.pt -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: transactions
hi there, i'm using two different database objects, for each connection. i still haven't tried with save points, but i will, to see what append. regards, andré Citando Heikki Tuuri <[EMAIL PROTECTED]>: > Andre, > > - Original Message - > From: <[EMAIL PROTECTED]> > Newsgroups: mailing.database.myodbc > Sent: Sunday, March 07, 2004 3:28 PM > Subject: transactions > > > > Hello there. > > > > i'm working with transactions, and i have one situtation where i start a > > transaction and execute the insert/update statement, then i execute > another > > start transaction for another db and execute the insert/update, and if > this > > return a error i do the rollback, and then i do the rollback for the first > > transaction. > > > > example: > > start transaction > > insert/update > > start transaction (for another database) > > insert/update ... > > rollback or commit > > rollback or commit (this rollback isn't working) > > > > my problem is that the rollback for the first transaction isn't working, > and= > > i > > don't understand why! > > > > can you help me? > > maybe you should use savepoints. Though, then if you rollback the outer > transaction, it will also rollback the inner 'transaction'. If that is not > ok, then you must use 2 different connections to MySQL. > > http://www.innodb.com/ibman.php#Savepoints > > > thanks, > > Andr=E9 Br=E1s > > Best regards, > > Heikki Tuuri > Innobase Oy > Foreign keys, transactions, and row level locking for MySQL > InnoDB Hot Backup - a hot backup tool for InnoDB which also backs up MyISAM > tables > http://www.innodb.com/order.php > > Register now for the 2004 MySQL Users Conference! > http://www.mysql.com/events/uc2004/index.html > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
transactions
Hello there. i'm working with transactions, and i have one situtation where i start a transaction and execute the insert/update statement, then i execute another start transaction for another db and execute the insert/update, and if this return a error i do the rollback, and then i do the rollback for the first transaction. example: start transaction insert/update start transaction (for another database) insert/update ... rollback or commit rollback or commit (this rollback isn't working) my problem is that the rollback for the first transaction isn't working, and i don't understand why! can you help me? thanks, André Brás -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]