andrisp Posted March 7, 2006 Report 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 ?
Delfins Posted March 7, 2006 Report 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
Delfins Posted March 7, 2006 Report Posted March 7, 2006 google vai domā pats. takš elemntāra lieta...
Kristabs Posted March 8, 2006 Report Posted March 8, 2006 A, bet $str = "SIA 'Vējiņs'"; $str = addslashes($str); ibase_query("SELECT * FROM `table` WHERE smth = '".$str."'"); neder?
Recommended Posts