php - Pass the variable in regular expression within heredoc (MYSQL) -
php - Pass the variable in regular expression within heredoc (MYSQL) -
i got parse error. passed variable in regular look within heredoc mysql query expression?
$sql = <<<sql select name, full_code m_category full_code regexp '^00'.$var.'[0-9][0-9][0-9]$' order full_code asc sql;
originally code was
$sql = " select name, full_code m_category full_code regexp '^00".$var."[0-9][0-9][0-9]$' order full_code asc";
$sql = <<<sql select name, full_code m_category full_code regexp '^00{$var}[0-9][0-9][0-9]$' order full_code asc sql;
please, read heredoc: http://php.net/manual/ru/language.types.string.php#language.types.string.syntax.heredoc
php mysql
Comments
Post a Comment