andrisp Posted March 7, 2006 Report Share Posted March 7, 2006 Kā sagatovot stringu ievietošanai SQL pieprasījumā priekš firebird(interbase) ? Tā lai ibase_query("SELECT * FROM `table` WHERE smth = '".$str."'"), kur $str = "SIA 'Vējiņs'" nenogljukotu. Kautkas līdzīgs mysql_real_escape_string ? Link to comment Share on other sites More sharing options...
Delfins Posted March 7, 2006 Report Share Posted March 7, 2006 (edited) google blin. /* * ibase doesn't seem to have the ability to pass a * parameter along unchanged, so strip off quotes from start * and end, plus turn two single quotes to one single quote, * in order to avoid the quotes getting escaped by * ibase and ending up in the database. */ $data[$key] = preg_replace("/^'(.*)'$/", "\\1", $data[$key]); $data[$key] = str_replace("''", "'", $data[$key]); PS: iz PEAR paņemts http://www.koders.com/php/fid75758F63BAAEC...54463E5FFB.aspx Edited March 7, 2006 by Delfins Link to comment Share on other sites More sharing options...
andrisp Posted March 7, 2006 Author Report Share Posted March 7, 2006 neizskatās īpaši labi Link to comment Share on other sites More sharing options...
Delfins Posted March 7, 2006 Report Share Posted March 7, 2006 google vai domā pats. takš elemntāra lieta... Link to comment Share on other sites More sharing options...
Kristabs Posted March 8, 2006 Report Share Posted March 8, 2006 A, bet $str = "SIA 'Vējiņs'"; $str = addslashes($str); ibase_query("SELECT * FROM `table` WHERE smth = '".$str."'"); neder? Link to comment Share on other sites More sharing options...
Recommended Posts