PHP에서 MySQL 데이터베이스의 정보를 가져 오는 코드가 있고 $ username 변수를 strpos() 함수의 정보와 비교하려고합니다.하지만 작동하지 않습니다. .. 나는 무엇을 할 수 있습니까? 대신 ==
와 바로 비교의 strpos
을 사용하는 이유는 'mysql_fetch_array의 strpos() 함수
$username = $_GET['username'];
$connection = new DB_Database();
$res = $connection->Select();
if ($res) {
$output = "";
while ($row = mysql_fetch_array($res)) {
if (strpos((string)$row['username'], $username)) {
$output.=" " . $row["username"] . " ";
}
echo $output;
"작동하지 않습니다."는 유효한 문제 설명이 아닙니다. – PeeHaa
왜이 비교를 SQL 쿼리의 일부로 시작하지 않습니까? 또한'strpos' 매뉴얼 페이지에 설명 된대로'== 0'과'=== false'의 차이를 잊어 버렸습니까? – deceze