Tassadar Posted October 25, 2007 Report Share Posted October 25, 2007 Problēma tāda - pirms mysql_query padodot string ar latviešu simboliem [ā,ž...], datu bāzē saglabājas tikai tā stringa daļa, kura ir pirms pirmā no šiem simboliem. Piemēram, no stringa "tukšums" saglabājas tikai "tuk". MySQL konekcija un kodējums ir utf-8, ar stringu nekas pirms tam darīts netiek, pat apstrādes skriptā echo $string visu parāda pareizi. Tā ir kaut kāda mysql_real_escape_string() specifika vai arī es kaut ko esmu palaidis garām? Link to comment Share on other sites More sharing options...
Tassadar Posted October 25, 2007 Author Report Share Posted October 25, 2007 Ok..izskatās, ka nevis mysql_real_escape_string(), bet gan sprintf(), caur kuru tiek formēts query būs pie vainas.. Link to comment Share on other sites More sharing options...
Grey_Wolf Posted October 25, 2007 Report Share Posted October 25, 2007 bet gan sprintf(), būs pie vainas.. Neticu ... tiko parbaudiju spritf() nesacakare kodejumu ... Peec idejas vinjam ir dzilji vienalga kas atrodas tajaa textaa... galvenais la butu pareizi salikti identifikatori ... drizaak jau kautkur kverijaa paraadas % Link to comment Share on other sites More sharing options...
Tassadar Posted October 25, 2007 Author Report Share Posted October 25, 2007 (edited) Baigi mānīgi..spritnf tiešām nav pie vainas. Uztaisīju citu konstrukciju bez sprintf un vienalga tas pats..ok, from the top: @$string = $_POST['string']; echo $string; //viss ok $connect = mysql_connect($server, $user, $password); $string = mysql_real_escape_string($string, $connect); echo $string; //viss vēl arvien ok mysql_query("insert into table ( `string` ) values ('$string')",$connect); //db iepostē visu līdz kādai no specifiskajām rakstzīmēm :/ Edited October 25, 2007 by Tassadar Link to comment Share on other sites More sharing options...
Grey_Wolf Posted October 25, 2007 Report Share Posted October 25, 2007 ------ mysql_real_escape_string() calls MySQL's library function mysql_real_escape_string, which prepends backslashes to the following characters: \x00, \n, \r, \, ', " and \x1a. ------ papildus lieto -> addcslashes() un stripslashes() Link to comment Share on other sites More sharing options...
Tassadar Posted October 25, 2007 Author Report Share Posted October 25, 2007 Kaut kas visticamāk nav ar attiecīgā servera instalāciju, jo uz citas platformas iet, kā vajadzētu. Paldies. Link to comment Share on other sites More sharing options...
Grey_Wolf Posted October 25, 2007 Report Share Posted October 25, 2007 palasies dokumetacija ... automatisko slashu pieliksanu/nonjemsanu var PHP.ini ieslegt izslegt .... ----------- get_magic_quotes_gpc -- Gets the current configuration setting of magic quotes gpc ------------- Link to comment Share on other sites More sharing options...
Recommended Posts