반응형
나는 이것을 2 시간까지하려고한다. I have custom fields in database and I want to get post_id by the meta keys or meta values. 나는 이렇게하고있다
$post_id = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE (meta_key = 'mfn-post-link1' AND meta_value = '". $from ."')");
print_r($post_id); // giving only 140
이것은 잘 작동하지만 이것은 하나의 post_id 만 제공하고 가능한 모든 post_id를 meta_value와 일치시키고 싶습니다. for example : I have three post 140,141,142, in database. But by this query I am only getting 140. 이 쿼리 또는 meta_fields를 비교하여 다른 방법으로 가능한 모든 post_id를 얻는 방법에 대한 아이디어 ...
감사
해결 방법
$post_id = $wpdb->get_results("SELECT post_id FROM $wpdb->postmeta WHERE (meta_key = 'mfn-post-link1' AND meta_value = '". $from ."')");
print_r($post_id); /
참조 페이지 https://stackoverflow.com/questions/19493075
반응형
'MySql' 카테고리의 다른 글
MySQL 루프 내의 여러 where 절을 laravel (0) | 2020.12.20 |
---|---|
MySQL MD5를 SHA256으로 변환 할 수 있습니까? (0) | 2020.12.20 |
MySQL SQL SELECT everything after a certain character (0) | 2020.12.20 |
MySQL 테이블이있는 경우 Java mysql (0) | 2020.12.20 |
MySQL libmysql.dll을로드 할 수 없습니다. (0) | 2020.12.20 |
댓글