Puika1 Posted October 23, 2010 Report Share Posted October 23, 2010 Kā šim http://paste.php.lv/0d4d63376eb6a9464b017abec1181545?lang=php scriptam var uztaisīt,lai pievieno ar id,piemēram tagad pievienojot datubāzē ar šo scriptu visi dati pievienojas ar id 0 Quote Link to comment Share on other sites More sharing options...
101111 Posted October 23, 2010 Report Share Posted October 23, 2010 Pievieno id kolonnai auto increment atribūtu Quote Link to comment Share on other sites More sharing options...
Puika1 Posted October 24, 2010 Author Report Share Posted October 24, 2010 kur tieši? Quote Link to comment Share on other sites More sharing options...
101111 Posted October 24, 2010 Report Share Posted October 24, 2010 datubāzē, "cup" tabulā Quote Link to comment Share on other sites More sharing options...
Puika1 Posted October 24, 2010 Author Report Share Posted October 24, 2010 (edited) kautkāda kļūda ALTER TABLE `cup` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT MySQL said: Documentation #1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key CREATE TABLE `cup` ( `id` int(11) NOT NULL, `name` text NOT NULL, `link` text NOT NULL, `info` text NOT NULL, `cena` text NOT NULL, `bilde` text NOT NULL, `game` text character set utf8 collate utf8_latvian_ci NOT NULL, `veids` text character set utf8 collate utf8_latvian_ci NOT NULL, `admin` text character set utf8 collate utf8_latvian_ci NOT NULL, `start` text character set utf8 collate utf8_latvian_ci NOT NULL, `status` text character set utf8 collate utf8_latvian_ci NOT NULL, `prize` text character set utf8 collate utf8_latvian_ci NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; Edited October 24, 2010 by Puika1 Quote Link to comment Share on other sites More sharing options...
Code Posted October 24, 2010 Report Share Posted October 24, 2010 Ieprovē šitā ALTER TABLE `cup` ADD PRIMARY KEY(`id`); ALTER TABLE `cup` CHANGE `id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT; Quote Link to comment Share on other sites More sharing options...
Puika1 Posted October 24, 2010 Author Report Share Posted October 24, 2010 Code iespējams es kautko nepareizi daru,bet man nesanāk Quote Link to comment Share on other sites More sharing options...
Code Posted October 24, 2010 Report Share Posted October 24, 2010 Man nez kāpēc aizdomas, ka tas dēļ primary key. Apskaties vai kādam citam laukam nav primary key uzlikts. Ja slinkums čakarēties un tabulā nav nekādu dižo datu, tad nodropo un uztaisi pareizi jaunu tabulu. Quote Link to comment Share on other sites More sharing options...
Rincewind Posted October 24, 2010 Report Share Posted October 24, 2010 Ka tik nav vispirms indekss jāuztaisa? ALTER TABLE `cup` ADD PRIMARY KEY (`id`) Un tad to autoincrement. Quote Link to comment Share on other sites More sharing options...
Puika1 Posted October 24, 2010 Author Report Share Posted October 24, 2010 Godīgi sakot,es nesapratu,pēc Rincewind rakstītā uzgooglēju un sataisiju visu paldies :) Quote Link to comment Share on other sites More sharing options...
Puika1 Posted October 24, 2010 Author Report Share Posted October 24, 2010 kāds scripts ir vaidzīgs lai varētu labot tabulu,pēc id? Quote Link to comment Share on other sites More sharing options...
Rincewind Posted October 24, 2010 Report Share Posted October 24, 2010 kāds scripts ir vaidzīgs lai varētu labot tabulu,pēc id? Vari kaut kā savādāk noformulēt? Nevar saprast. Quote Link to comment Share on other sites More sharing options...
Puika1 Posted October 24, 2010 Author Report Share Posted October 24, 2010 Piemēram ar php labot tabulu! piem. tabulas id 1 un lauki name info utt (velme ir labot tos name info utt) nejau visiem irerakstiem,bet pec konkreta id Quote Link to comment Share on other sites More sharing options...
Rincewind Posted October 24, 2010 Report Share Posted October 24, 2010 Piemēram ar php labot tabulu! piem. tabulas id 1 un lauki name info utt (velme ir labot tos name info utt) nejau visiem irerakstiem,bet pec konkreta id $q=sprintf("UPDATE tabula SET lauks1=%s,lauks2=%s,laiks3=%s WHERE id=%d",$string1,$string2,$string3,$id); mysql_query($q); Vai, ja nepatīk sprintf (un datu tipu pārbaude) tad: $q=mysql_query"UPDATE tabula SET lauks1=$string1 WHERE id=$id"; Quote Link to comment Share on other sites More sharing options...
Puika1 Posted October 24, 2010 Author Report Share Posted October 24, 2010 čota nesapratu,bet uzgooglēju atradu dažus variantus,bet man neīpaši pie sirds,ka tas sastāv no 4 php failiem Kāds zin kādus scriptus google,kas sastāv no 1 vai 2 php failiem? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.