Reputation: 69
I have the following code in my controller:
<?php
class skillsController extends \Phalcon\Mvc\Controller
{
public function indexAction()
{
$skills = Skills::find();
$this->view->setVar("skills", $skills);
}
public function deleteSkillAction()
{
$GLOBALS['gID'] = $_GET["id"];
}
public function yesAction()
{
$id = $GLOBALS['gID'];
echo $id;
$manager = $this->modelsManager;
$phql = "DELETE FROM skills WHERE id =:id:";
$manager->executeQuery($phql, array('id' => $id));
}
public function noAction()
{
}
}
I am retriving a varible called id via GET and setting it to $GLOBALS['gID'] in my deleteSkillAction function, now why when i call it in the yesAction function does phalcon not know what this varible is?
Upvotes: 0
Views: 205
Reputation: 1700
You should read more basic information about PHP and HTTP. There is nothing wrong with Phalcon here. You assigned variable to GLOBALS array during request to the deleteSkill action, and then you try to access this variable during another request to the yesAction. Use some persistent container for this case: session or memcache for example.
Upvotes: 3