'Programming'에 해당되는 글 155건
NOTICE
[PDO]
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.' in /home/xxxxx/www/xxxx/xxxxx.p..
mysqli에서 get_result() 작동 안 될 때
$smtp = mysqli->prepare("SELECT * FROM #table WHERE uname = ?"); $smtp->bind_param("s", $_GET['name']); $smtp->execute(); $smtp->get_result();자신이 서버 운영자라면 아래처럼 해서 mysqlnd를 설치하고 그렇지 않다면 깔끔하게 포기하고 store_result()로... sudo apt-get install php5-mysqlnd참고로 php.net을 가 보면 "Available only with mysqlnd."라고 되어 있다.
[MySQL]null 값 치환
col_a col_b 1000 null 200 100 위와 같은 칼럼(둘 다 int)이 있다고 가정하자.SELECT COUNT(*) AS cnt FROM #table WHERE col_a > col_b이렇게 명령을 하였을 경우 결과는 1이 나온다. 물론 처음부터 해당 칼럼을 default는 0, not null을 하면 되겠지만 말이다.SELECT COUNT(*) AS cnt FROM #table WHERE COALESCE(col_a, 0) > COALESCE(col_b, 0)COALESCE(칼럼명, 해당 칼럼이 null일 경우 대체할 값)라는 함수를 사용하면 된다.