dmi Posted October 12, 2008 Report Posted October 12, 2008 <? error_reporting(E_ALL); ini_set('display_errors',1); $dbserver="localhost"; $dbuser="users"; $dbpass="parole"; $dbname="auro"; @$connection=mysql_pconnect($dbserver,$dbuser,$dbpass); mysql_select_db($dbname); @$outcome=mysql_query("INSERT INTO surveys_lv ( '$_POST[2]','$_POST[te]','$_POST[5]','$_POST', '$_POST[a]','$_POST','$_POST[c]','$_POST[d]','$_POST[e]', '$_POST[1]','$_POST[1]','$_POST[1]','$_POST[1]','$_POST[1]')") if (!$outcome){echo "nav ievada";} ?> parāda browserī tikai: nav ievada globals: ieslēgti datubaazes: 777 nix: kubuntu
bubu Posted October 12, 2008 Report Posted October 12, 2008 Vajag nevis echo"nav ievada", bet gan echo mysql_error() rakstīt. Tad redzēsi precīzu kļūdas paziņojumu kāpēc kverijs nav nostrādājis.
dmi Posted October 12, 2008 Author Report Posted October 12, 2008 <? $dbserver="localhost"; $dbuser="dmi"; $dbpass="axoe"; $dbname="auro"; $connection=mysql_pconnect($dbserver,$dbuser,$dbpass); mysql_select_db($dbname); $outcome=mysql_query("INSERT INTO surveys_lv ( '$_POST[2]', '$_POST[te]', '$_POST[5]', '$_POST', '$_POST[a]', '$_POST', '$_POST[c]', '$_POST[d]', '$_POST[e]', '$_POST[1]', '$_POST[1]', '$_POST[1]', '$_POST[1]', '$_POST[1]')"); if (!$outcome){echo mysql_error();} ?> pievienoju mysql_error() un nonjeemu @ izdeva: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''2', '', '', '', '', '', '', '', '', '', '', '', '', '')' at line 2 kas tas ir nesaprotu Kods kas augshpus ir kaa uz servera
bubu Posted October 12, 2008 Report Posted October 12, 2008 Nu redz - skaidri un gaiši uzrakstīts, ka tavā SQL teikumā ir sintaktiska kļūda. Izdrukā kveriju uz ekrāna vai ieraksti failā un skaties uz to un meklē kļūdu.
dmi Posted October 12, 2008 Author Report Posted October 12, 2008 neiebraucu kur ir kljuuda : viss tacha sintastiski pareizi: Māceklis Group: Reģistrētie lietotāji Posts: 2 Joined: Today, 15:57 Member No.: 3 385 Warn: (0%) <? $dbserver="localhost"; $dbuser="dmi"; $dbpass="axoe"; $dbname="auro"; $connection=mysql_pconnect($dbserver,$dbuser,$dbpass); mysql_select_db($dbname); $outcome=mysql_query("INSERT INTO surveys_lv ( '$_POST[2]', '$_POST[te]', '$_POST[5]', '$_POST', '$_POST[a]', '$_POST', '$_POST[c]', '$_POST[d]', '$_POST[e]', '$_POST[1]', '$_POST[1]', '$_POST[1]', '$_POST[1]', '$_POST[1]')"); if (!$outcome){echo mysql_error();} ?>
bubu Posted October 12, 2008 Report Posted October 12, 2008 Kādā jēgā tu visu laiku postē savu php kodu? Ar vienu reizi mums pietiek, varam apskatīties to augstāk. Skrollēt browsera logā neviens vēl nav aizliedzis. SQL kveriju apskaties kāds tas izskatās (mysql_query vieta uzraksti echo), tur tev ir problēma.
dmi Posted October 12, 2008 Author Report Posted October 12, 2008 samainiiju kodaa mysql_query uz echo izdeva Parse error: syntax error, unexpected T_ECHO in /var/www/latvia_new/test.php on line 9 neizprotu kaads sakars mysql_query un echo
mounkuls Posted October 12, 2008 Report Posted October 12, 2008 (edited) izskatās, ka vaina ir $outcome=mysql_query("INSERT INTO `surveys_lv` VALUES(...........)"); Bet nu droši neņemos apgalvot. Vai arī lauku skaits vai tips neatbilst. neizprotu kaads sakars mysql_query un echo bubu jau to nedomāja tik burtiski lai samaini tikai mysql_query pret echo:) Edited October 12, 2008 by mounkuls
bubu Posted October 12, 2008 Report Posted October 12, 2008 echo "INSERT INTO .... POST ... POST ... POST.... "; Tā to vajadzēja saprast.
dmi Posted October 13, 2008 Author Report Posted October 13, 2008 bubu:izdariiju kaa liki: echo"INSERT INTO surveys_lv $_POST[2],$_POST[te],$_POST[5],$_POST,$_POST[a],$_POST,$_POST[c],$_POST[d],$_POST[e],$_POST[1],$_POST[1],$_POST[1],$_POST[1],$_POST[1]"; izdod brauzerii: INSERT INTO surveys_lv , , , , , , , , , , , , ,
andrisp Posted October 13, 2008 Report Posted October 13, 2008 Nu ja tā tieši arī zdod, tad jau pats redzi, ka kverijs pilnīgi un galīgi nepareizs. http://dev.mysql.com/doc/refman/5.0/en/insert.html
dmi Posted October 13, 2008 Author Report Posted October 13, 2008 paldies visiem par paliidziibu visu atrisinaaju. pievinoju kverijaa values un viss iet.paldies
Recommended Posts