Possible problem: you are sending a HTTP header while already having some data in output buffer
Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
- microcz
- Člen | 62
V presenteru mám umístěn button, na který když se klikne, tak se vykoná následující kód:
public function handleSaveResponse() {
$this->db->begin();
try {
// Retrieve ID
$userId = $this->user->id;
$offerId = $this->id;
// Load offer
$offer = $this->createDao("Offer", $offerId);
if ($offer == null || !$offer->isPopulated()) {
throw new \Exception('No offer or demand specified for response.');
}
// Retrieve advertisement object
$advert = $offer->getLazyAdvertisement();
if ($advert == null || !$advert->isPopulated()) {
throw new \Exception('Cannot load advertisement for offer.');
}
// Check active
if ($advert->getState() !== 'active') {
throw new \Exception('Cannot response inactive offer.');
}
// Check author
if ($userId === $advert->getAuthorId()) {
throw new \Exception('Cannot post response for own advertisement.');
}
// Select price and save response
$q = 'SELECT price_total FROM view_offer WHERE offer_id=%i';
$p = $this->db->fetchSingle($q, intval($offer->getId()));
if ($p == false) {
throw new \Exception('Cannot select price of advertised item(s).');
}
$this->createDao("Response")->createForOffer($offer->getId(), $userId, $p);
} catch (\Exception $e) {
$this->db->rollback();
throw $e;
}
// Commit and redirect to list of responses
$this->db->commit();
$this->redirect("Response:list");
}
Vyvolá se ale tato chyba
Possible problem: you are sending a HTTP header while already having some data in output buffer. Try OutputDebugger or start session earlier.
Poradíte proč?