Martiny Posted March 25, 2004 Report Share Posted March 25, 2004 Lieta sekojosha: Visu laiku straadaaja, bet nu ir problema datus no HTML formas saglabaat datubazee. Izmet pazinjojumu "Column count doesn't match value count at row 1". Kaa sho probleemu atrisinaat? Link to comment Share on other sites More sharing options...
Gacha Posted March 25, 2004 Report Share Posted March 25, 2004 Paradi to kodu un ari to kaa tev DB saucas lauki Link to comment Share on other sites More sharing options...
Martiny Posted March 25, 2004 Author Report Share Posted March 25, 2004 Shis kods no formas un arii citaadi ieguutos datus saglabaa datubaazes katalogs tabulaa adreses <?php $pasutitajs=$HTTP_POST_VARS['pasutitajs']; $reg_num=$HTTP_POST_VARS['reg_num']; $adrese=$HTTP_POST_VARS['adrese']; $pilseta=$HTTP_POST_VARS['pilseta']; $lv=$HTTP_POST_VARS['lv']; $telefons=$HTTP_POST_VARS['telefons']; $p_adrese=$HTTP_POST_VARS['p_adrese']; $p_pilseta=$HTTP_POST_VARS['p_pilseta']; $p_lv=$HTTP_POST_VARS['p_lv']; $banka=$HTTP_POST_VARS['banka']; $swift=$HTTP_POST_VARS['swift']; $konts=$HTTP_POST_VARS['konts']; $lietotajs=$HTTP_POST_VARS['lietotajs']; $parole=$HTTP_POST_VARS['parole']; $savienojums=mysql_connect("localhost", "root")or die(mysql_error()); $datubaze=mysql_select_db("katalogs", $savienojums); $ip = getenv("REMOTE_ADDR"); $viss=$_SERVER["HTTP_USER_AGENT"]; $rezultats=explode(";", $viss); $explorer=$rezultats[1]; $os=str_replace(")"," ", $rezultats[2]); $query3="INSERT INTO adreses (pasutitajs, reg_num, adrese, lv, telefons, banka, swift, konts, p_adrese, p_pilseta, p_lv, lietotajs, parole, ip, os, explorer) VALUES ('$pasutitajs', '$reg_num', '$adrese', '$pilseta', '$lv', '$telefons', '$banka', '$swift', '$konts', '$p_adrese', '$p_pilseta', '$p_lv', '$lietotajs', '$parole', '$ip', '$os', '$explorer')"; mysql_query($query3); echo mysql_error(); mysql_close ($savienojums); ?> Datubaazes struktuura sekojosha: adreses_id int(11) pasutitajs varchar(30) reg_num varchar(25) adrese varchar(30) pilseta varchar(20) lv varchar(10) telefons varchar(18) banka varchar(30) swift varchar(20) konts varchar(30) p_adrese varchar(30) p_pilseta varchar(20) p_lv varchar(10) lietotajs varchar(25) parole varchar(20) ip varchar(25) os varchar(20) explorer varchar(30) ,bet galvenais ka ar identisku metodi datus vienmeer esmu vareejis saglabaat. Paldies teikshu kaut par nieciigaako ideju. Link to comment Share on other sites More sharing options...
Martiny Posted March 25, 2004 Author Report Share Posted March 25, 2004 Piedodiet par trauceejumu. Izraadaas, ka nepareizs ir tas INSERT, jo ievietojamie lauki uzraadiiti tikai 16, bet ierakstaamaas veertiibas ir 17. Liidz ar to izmet shaadu kljuudas pazinjojumu "Column count doesn't match value count at row 1", ja peec mysql_query($query); Ir ievietota rindinja echo mysql_error(); Paldies, pats tiku galaa. mysql_close ($savienojums); Link to comment Share on other sites More sharing options...
Aleksejs Posted March 25, 2004 Report Share Posted March 25, 2004 (edited) Problēma ir tur, ka iekš vaicājuma ir vairāk vērtību(17) nekā kolonnu(16). (pasutitajs, reg_num, adrese, lv, telefons, banka, swift, konts, p_adrese, p_pilseta, p_lv, lietotajs, parole, ip, os, explorer) VALUES ('$pasutitajs', '$reg_num', '$adrese', '$pilseta', '$lv', '$telefons', '$banka', '$swift', '$konts', '$p_adrese', '$p_pilseta', '$p_lv', '$lietotajs', '$parole', '$ip', '$os', '$explorer')"; Hint: varbūt vērtības $adrese un $pilseta ir jāapvieno ;) Ehh, nokavēju :P Edited March 25, 2004 by Aleksejs Link to comment Share on other sites More sharing options...
Recommended Posts