millers Posted May 2, 2008 Report Share Posted May 2, 2008 ko nozime sis errors kas jadara ? man uzmetas sads mysql errors kad veicu registraciju ... Could not insert data because Incorrect integer value: 'NULL' for column 'id' at row 1 sads te mysql tabulu kods ... sis skripts ielikts caur php ... $create = "create table $table ( id smallint(5) NOT NULL auto_increment, username varchar(30) NOT NULL default '', password varchar(32) NOT NULL default '', name1 varchar(32) NOT NULL default '', name2 varchar(32) NOT NULL default '', email varchar(62) NOT NULL default '', website varchar(250) NOT NULL default '', avatar varchar(255) NOT NULL default '', PRIMARY KEY (id), UNIQUE KEY username (username) );"; Link to comment Share on other sites More sharing options...
mounkuls Posted May 2, 2008 Report Share Posted May 2, 2008 Kad INSERTo tabulā, ievieto id laukā '0' vai 'NULL' ? Link to comment Share on other sites More sharing options...
millers Posted May 2, 2008 Author Report Share Posted May 2, 2008 nesapratu bisk ... kas mna jadarA? Link to comment Share on other sites More sharing options...
mounkuls Posted May 2, 2008 Report Share Posted May 2, 2008 (edited) Cik sapratu no kļūdas paziņojuma, nevar tabulai laukā `id` ierakstīt NULL? Tabulu tātad izveidojis esi. Tas php fragments, kuru rādi, ir kverija strings lai izveidotu tabulu bāzē. Es gan parasti laukam id lietoju -> `id` int(6) NOT NULL auto_increment, bet tas tā. Parādi to mysql_query( "INSERT INTO tabula VALUES(........);"); vai kā Tev tur ir. Vai arī neesmu sapratis un tabulu nemaz neizveido? Manas domas: Spriežot pēc error, mēģina ievieto id laukā 'NULL', tas ir stringu. Vajag integer, tātad nurmālu nulli. Edited May 2, 2008 by mounkuls Link to comment Share on other sites More sharing options...
andrisp Posted May 2, 2008 Report Share Posted May 2, 2008 mounkuls tev uzdod jautājumu. Varbūt vienkārši iemet te savu kveriju, ko mēģini izpildīt. Link to comment Share on other sites More sharing options...
millers Posted May 2, 2008 Author Report Share Posted May 2, 2008 rekur ir mans reg scripts ... http://paste.php.lv/7290 Link to comment Share on other sites More sharing options...
mounkuls Posted May 2, 2008 Report Share Posted May 2, 2008 (edited) Man bija taisnība mysql_query("insert into $table values ('NULL', ' Lieto mysql_query("insert into $table values (0, ' Edited May 2, 2008 by mounkuls Link to comment Share on other sites More sharing options...
millers Posted May 2, 2008 Author Report Share Posted May 2, 2008 un kas man tagad jadara lai viss ietu kaa nakas? Link to comment Share on other sites More sharing options...
mounkuls Posted May 2, 2008 Report Share Posted May 2, 2008 Izlabo uz parstu 0 to 'NULL'! 'NULL' nozīmē strings, bet lauks id ir int un vēl auto_increment, kas pats id palielina katram nākamajam ierakstam. Kā tad MySQL to 'NULL' lai palielina par vienu?:) Datu tips neatbilst. Link to comment Share on other sites More sharing options...
millers Posted May 2, 2008 Author Report Share Posted May 2, 2008 (edited) aa nee viss oke thxx.. big thx tev. .. Edited May 2, 2008 by millers Link to comment Share on other sites More sharing options...
andrisp Posted May 2, 2008 Report Share Posted May 2, 2008 Izlabo uz parstu 0 to 'NULL'! Nu vispār tā arī nepareizi ir darīt, bet nu ja nav strict modē serveris, tad strādās. Link to comment Share on other sites More sharing options...
mounkuls Posted May 2, 2008 Report Share Posted May 2, 2008 Nu man nebija gadijies tā, ka nestrādā vēl līdz šim. Es jau pats MySQL tik nesen sāku apgūt. Tas http://sqlzoo.net links tiešām super, paldies andrisp!:) Vismaz nu ir nojēga par JOIN daudz maz:) Link to comment Share on other sites More sharing options...
Recommended Posts