We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Issue while inserting record in table

//Insert Stat Information...

$phql = "INSERT into TlbStatSampleDownload(first_name,last_name,company_name,email_address,phone_number,tech_name,tech_slug,downloaded_date,tech_type,tech_type_value,reff_url)values('".addslashes($this->request->getPost('FirstName'))."',
'".addslashes($this->request->getPost('LastName'))."',
'".addslashes($this->request->getPost('companyname'))."',
'".addslashes($this->request->getPost('emailaddress'))."',
'".addslashes($this->request->getPost('phonenumber'))."',
'".addslashes($this->request->getPost('tech_name'))."',
'".addslashes($this->request->getPost('tech_slug'))."',
now(),
'".addslashes($this->request->getPost('payment_tech_type'))."',
'".addslashes($this->request->getPost('payment_tech_name'))."',
'".addslashes($this->request->getPost('pagefrom'))."')";
$success = $this->modelsManager->executeQuery($phql);

Above Query is not working..



98.9k

Are you getting an error or something?



8.7k

No sir I am not getting any such error..



8.7k
edited Sep '14

Even i f i write this sql on my view page its not working.

$phql = "INSERT into TlbStatSampleDownload(first_name,last_name,company_name,email_address,phone_number,tech_name,tech_slug,downloaded_date,tech_type,tech_type_value,reff_url)values('".addslashes($this->request->getPost('FirstName'))."',
'".addslashes($this->request->getPost('LastName'))."',
'".addslashes($this->request->getPost('companyname'))."',
'".addslashes($this->request->getPost('emailaddress'))."',
'".addslashes($this->request->getPost('phonenumber'))."',
'".addslashes($this->request->getPost('tech_name'))."',
'".addslashes($this->request->getPost('tech_slug'))."',
now(),
'".addslashes($this->request->getPost('payment_tech_type'))."',
'".addslashes($this->request->getPost('payment_tech_name'))."',
'".addslashes($this->request->getPost('pagefrom'))."')";
$success = $this->modelsManager->executeQuery($phql);


33.8k

Errr maybe if you put a space here:

..., reff_url) values(...



98.9k

You probably want to check if validation messages were produced:

$result = $manager->executeQuery($phql);
if ($result->success() == false)
{
    foreach ($result->getMessages() as $message)
    {
        echo $message->getMessage();
    }
}