Re: [PHP-DB] how to explain such a regular syntax

2010-08-12 Thread Peter Lind
On 13 August 2010 08:47, win.a wrote: > Its was picked from drupal source code and i don't know how does it works. > This is the code : > preg_match('/^\[?(?:[a-z0-9-:\]_]+\.?)+$/', $host); This has got nothing to do with php or php-db - your question is on regular expressions. Try consulting htt

[PHP-DB] how to explain such a regular syntax

2010-08-12 Thread win.a
Its was picked from drupal source code and i don't know how does it works. This is the code : preg_match('/^\[?(?:[a-z0-9-:\]_]+\.?)+$/', $host); After followed the regular syntax ,i try to cut it into pieces to make it simpler to understand , part a1: ^\[? part a2:([a-z0-9-:\]_]+\.?)+$ Then go o

Re: [PHP-DB] SELECT with ' in search term

2010-08-12 Thread Chris
On 13/08/10 13:26, Ron Piggott wrote: If the variable $segment has an ' in it the $query won't work because of having 3 ' 's. Should I be using: $segment = mysql_real_escape_string($segment); before querying the database? Use it in your query. Don't use it anywhere else. Your code may use it

[PHP-DB] SELECT with ' in search term

2010-08-12 Thread Ron Piggott
If the variable $segment has an ' in it the $query won't work because of having 3 ' 's. Should I be using: $segment = mysql_real_escape_string($segment); before querying the database? $query="SELECT `reference` FROM `bible_concordance_words` WHERE `word` = '$segment' LIMIT 1"; Please note: $s