prepare($sql); // Bind the category parameter $stmt->bind_param("s", $name); // Execute the query $stmt->execute(); // Get the result $result = $stmt->get_result(); // Initialize an array to store encountered IDs $encountered_ids = array(); ?>

My 's

num_rows > 0) { // Output data of each row while ($row = $result->fetch_assoc()) { $id = $row["id"]; // Check if ID is already encountered if (in_array($id, $encountered_ids)) { // Skip if ID is already encountered continue; } // Store the encountered ID $encountered_ids[] = $id; $image_url = $row["image_url"]; $title = $row["title"]; ?>