나는 이벤트 프로젝트에서 작업 중이며 프로필 페이지에서 호스팅 한 내 사용자의 이벤트를 보여주고 싶지만 이벤트 목록을 보았습니다.PHP PDO 이벤트 목록에 대한 쿼리
다른 것들은 잘 작동합니다.
if(isset($_GET["id"])) {
$id = intval($_GET["id"]);
if(!empty($id)) {
try {
$pq = "SELECT * FROM `users` WHERE `id` = :id";
$pq_check = $db->prepare($pq);
$pq_check->bindParam(':id', $id, PDO::PARAM_INT);
$pq_check->execute();
$ac = $db->query("SELECT FOUND_ROWS()")->fetchColumn();
}
catch(PDOException $e) { $log->logError($e." - ".basename(__FILE__));
}
// i'm fetching the user info and showing them name age gender exc. , no problem with here
echo "Events That User Hosted :\n";
// here is the place i have problem
$eq = "SELECT * FROM `events` WHERE `host_id` = :id";
$eq_check = $db->prepare($eq);
$eq_check->bindParam(':id', $id, PDO::PARAM_INT);
$eq_check->execute();
$foo = $db->query("SELECT FOUND_ROWS()")->fetchColumn();
if(!empty($foo)) {
$_loader = true;
$fetch = $eq_check->fetch (PDO::FETCH_ASSOC);
}
while($fetch = $eq_check->fetch (PDO::FETCH_ASSOC)){
if ($fetch == NULL) {
break;
}
$event_id = $fetch['event_id'];
$event_name = $fetch['event_name'];
$link = "https://www.mywebsite.com/e/$event_id";
echo "<a target=\"_blank\" href=\"$link\"><li>$event_name</li></a>";
}
}
}
이
실제 문제 *는 무엇입니까? SQL 오류, 예상 한 데이터가 아닙니다. – Fluffeh
오류를주지는 않지만 인쇄하지 않는 경우 –