我的正则表达式foo是不是最好的,但下面不工作,我正在寻找一个小小的建议:REGEXT在MySQL查询
$query = $_GET['indicator'];
// given: 239,240 or 240,239 or 238,239,240
// and: 239, 240 or 240, 239 or 238, 239, 240
// and: 239
// we need to check for start+number+puntuation(1), punctuation+number+end(2), punctuation+number+punctuation(3)
// space+number+end(4), space+number+punctuation(6)
// start+number+end(6)
$sql = 'SELECT * from reports WHERE dataSetIDs REGEXP \'';
$sql .= '^'.$query.'[:punct:]|'; // 1
$sql .= '[:punct:]'.$query.'$|'; // 2
$sql .= '[:punct:]'.$query.'[:punct:]|'; // 3
$sql .= '[:space:]'.$query.'$|'; // 4
$sql .= '[:space:]'.$query.'[:punct:]|'; // 5
$sql .= '^'.$query.'$\''; // 6
$result = mysql_query($sql);
查询正在注视哪个具有CSV特定的细胞格式化的一组数字格式没有设置(即逗号后面可能有空格)。我得到的只有一个条目的行...但不是在csv中有数字的行。
任何指针非常赞赏。
干杯,
大教堂
-1 SQL注入漏洞:看http://stackoverflow.com/questions/332365/xkcd-sql-injection-please-explain(但出票) – Johan 2011-05-28 20:51:10