我正在做一个活动项目,我想展示我的用户在他们的个人资料页面中举办的活动,但我一直坚持列出这些活动。
其他事情都运作良好。
以下是代码:
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>";
}
}
}
谢谢