Swear Posted December 24, 2009 Report Share Posted December 24, 2009 Nesanāk qverijs kas updeito lauku vai izveido jaunu lauku, ja lauks ar tādu 'name' neeksistē: INSERT INTO tabula(name, lauks, lauks2, lauks3) VALUES('vards', '0', '1', '2') ON DUPLICATE KEY UPDATE tabula (lauks,lauks2,lauks3) VALUES (0,1,2) WHERE name='vards' 'name' ir text tādēļ nevar uzlikt uz primary. kādi risinājumi? jātaisa id lauks ar auto increment vai?.. Link to comment Share on other sites More sharing options...
waplet Posted December 24, 2009 Report Share Posted December 24, 2009 primary var uzlikt jebkuru, unless ja tev nav auto increment uztaisits Link to comment Share on other sites More sharing options...
Swear Posted December 25, 2009 Author Report Share Posted December 25, 2009 (edited) kā tad tādu uztaisīt? pagaidām tabula izskatās šādi CREATE TABLE IF NOT EXISTS `tabula` ( `name` text NOT NULL DEFAULT '', `lauks` int(11) NOT NULL DEFAULT '0', `lauks1` int(11) NOT NULL DEFAULT '0', `lauks2` int(11) NOT NULL DEFAULT '0' ) ENGINE=MyISAM DEFAULT CHARSET=latin1; Edited December 25, 2009 by Swear Link to comment Share on other sites More sharing options...
waplet Posted December 25, 2009 Report Share Posted December 25, 2009 tev phpmyadmin nava? Link to comment Share on other sites More sharing options...
Swear Posted December 25, 2009 Author Report Share Posted December 25, 2009 nu nevar izveidot jau visu izmēģināju.. neļauj uz text lauka likt primary un viss Link to comment Share on other sites More sharing options...
Grey_Wolf Posted December 25, 2009 Report Share Posted December 25, 2009 (edited) neļauj uz text lauka likt primary un viss text lauks NEVAR buut kaa primary !!! spriezjot pec nosaukuma name tas buus kautkaads vards/niks .. un diezvai parsniegs 255 simbolus .. piedevam padoma vai likt CHAR vai WARCHAR char stradas atrak nekaa warchar , jo lauka garums ir Fikseets, bet protam tabula Fiziski buus lielaka -- P.S. un parliecinies arii vai tiesam tev tur glabasies tikai Anglju alfabeta burti // ) ENGINE=MyISAM DEFAULT CHARSET=latin1; // Edited December 25, 2009 by Grey_Wolf Link to comment Share on other sites More sharing options...
Swear Posted December 25, 2009 Author Report Share Posted December 25, 2009 Paldies, viss sanāca :) Link to comment Share on other sites More sharing options...
Recommended Posts