Hi guys,
I'm trying to connect Asterisk to the MySQL, but I can't execute it. It
returns an error, as below:
-- Executing [200 at teste:2] MYSQL("Console/dsp", "Query
resultid 1 SELECT/
ramal/ FROM/ colaboradores/ WHERE/ ramal=200") in new stack
[Feb 18 15:55:13] WARNING[7696]: app_mysql.c:393 aMYSQL_query: aMYSQL_query:
mysql_query failed. Error: You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right syntax to
use near '/ ramal/ FROM/ colaboradores/ WHERE/ ramal=200' at line 1
Its seems it can connect to mysql
My extension (AEL) is:
MySQL(Connect conn_id localhost root 123456 crm);
MySQL(Query resultid ${conn_id} SELECT/ ramal/ FROM/
colaboradores/ WHERE/ ramal=${EXTEN});
MySQL(Fetch fetchid ${resultid} RAMAL);
MySQL(Clear ${fetchid});
MySQL(Disconnect ${connid});
MySQL(Clear ${connid});
NoOp(${RAMAL});
Where is the error? Thanks!!
The MySQL server is in the same server where Asterisk is running.
Thanks!!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.digium.com/pipermail/asterisk-users/attachments/20110218/532dfdcb/attachment.htm>
---------- Forwarded message ----------
From: Felipe Figueiredo <felipe.figueiredo86 at gmail.com>
Date: Fri, Feb 18, 2011 at 4:03 PM
Subject: Re: [asterisk-users] cmd MySQL
To: Gerald A <geraldablists at gmail.com>
- Executing [200 at teste:2] MYSQL("Console/dsp", "Query resultid
1 SELECT\
ramal\ FROM\ colaboradores\ WHERE\ ramal=200") in new stack
[Feb 18 16:01:42] WARNING[7749]: app_mysql.c:393 aMYSQL_query: aMYSQL_query:
mysql_query failed. Error: You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right syntax to
use near '\ ramal\ FROM\ colaboradores\ WHERE\ ramal=200' at line 1
hi Gerald,
look, the error is the same. Eveng changing the "/" for "\"
...
On Fri, Feb 18, 2011 at 4:00 PM, Gerald A <geraldablists at gmail.com>
wrote:
> Hi Felipe,
>
> On Fri, Feb 18, 2011 at 12:56 PM, Felipe Figueiredo <
> felipe.figueiredo86 at gmail.com> wrote:
>
>>
>> -- Executing [200 at teste:2] MYSQL("Console/dsp",
"Query resultid 1 SELECT/
>> ramal/ FROM/ colaboradores/ WHERE/ ramal=200") in new stack
>> [Feb 18 15:55:13] WARNING[7696]: app_mysql.c:393 aMYSQL_query:
>> aMYSQL_query: mysql_query failed. Error: You have an error in your SQL
>> syntax; check the manual that corresponds to your MySQL server version
for
>> the right syntax to use near '/ ramal/ FROM/ colaboradores/ WHERE/
>> ramal=200' at line 1
>>
>
> I'm not Asterisk-MySQL guru, but shouldn't the "/" be
"\"?
>
> I'm guessing you are trying to keep a string together here, but maybe
I'm
> mistaken.
>
> Thanks,
> Gerald
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.digium.com/pipermail/asterisk-users/attachments/20110218/8c0d3155/attachment.htm>
Try rrplacing "MySQL(Query resultid ${conn_id} SELECT/ ramal/ FROM/
colaboradores/ WHERE/ ramal=${EXTEN});"
With "MySQL(Query resultid ${conn_id} SELECT `ramal` FROM
`colaboradores` WHERE `ramal`='${EXTEN}');"
-----Original Message-----
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Felipe
Figueiredo
Sent: 18 February 2011 17:57
To: asterisk-users at lists.digium.com
Subject: [asterisk-users] cmd MySQL
Hi guys,
I'm trying to connect Asterisk to the MySQL, but I can't execute it. It
returns an error, as below:
-- Executing [200 at teste:2] MYSQL("Console/dsp", "Query
resultid 1
SELECT/ ramal/ FROM/ colaboradores/ WHERE/ ramal=200") in new stack
[Feb 18 15:55:13] WARNING[7696]: app_mysql.c:393 aMYSQL_query:
aMYSQL_query: mysql_query failed. Error: You have an error in your SQL
syntax; check the manual that corresponds to your MySQL server version
for the right syntax to use near '/ ramal/ FROM/ colaboradores/ WHERE/
ramal=200' at line 1
Its seems it can connect to mysql
My extension (AEL) is:
MySQL(Connect conn_id localhost root 123456 crm);
MySQL(Query resultid ${conn_id} SELECT/ ramal/ FROM/
colaboradores/ WHERE/ ramal=${EXTEN});
MySQL(Fetch fetchid ${resultid} RAMAL);
MySQL(Clear ${fetchid});
MySQL(Disconnect ${connid});
MySQL(Clear ${connid});
NoOp(${RAMAL});
Where is the error? Thanks!!
The MySQL server is in the same server where Asterisk is running.
Thanks!!!
If you have received this communication in error we would appreciate
you advising us either by telephone or return of e-mail. The contents
of this message, and any attachments, are the property of DataVox,
and are intended for the confidential use of the named recipient only.
If you are not the intended recipient, employee or agent responsible
for delivery of this message to the intended recipient, take note that
any dissemination, distribution or copying of this communication and
its attachments is strictly prohibited, and may be subject to civil or
criminal action for which you may be liable.
Every effort has been made to ensure that this e-mail or any attachments
are free from viruses. While the company has taken every reasonable
precaution to minimise this risk, neither company, nor the sender can
accept liability for any damage which you sustain as a result of viruses.
It is recommended that you should carry out your own virus checks
before opening any attachments.
Registered in England. No. 27459085.