Read and write data from MySQL

(Galaxy Lam) #1

Hello, every one.

I have a MySQL table:
INSERT INTO booking (id, date, type) VALUES
(1, ‘10/10/2017’, ‘treatment1’),
(2, ‘11/10/2017’, ‘treatment2’);

I would like to do a simple operation, the bot ask user to enter an ID, when user enter the ID, the bot will show the corresponding date of the ID.

I have tried as below, but it doesn’t work.

Bot : Ask a question
Test type question : Which id ?
Name : ask id

Connected MySQL account
Data:
id, {{ask_id.parsed_answer}}
Query:
select date from booking where id = :id
Name : Run a Query

Bot “ Send a message
The date of this ID : {ask_id.parsed_answer}} is {{date}}

May I know is there any idea how to make it worked? Many thanks !

(Daniel Beckett) #2

Hi,

I can see that this question was also emailed to the support team. Just thought I’d share the answer here too:

I think the easiest method for this would be to ask for an I.D. and then do a MySQL > Get a Row action to search for the row based on the I.D. provided. For example:

You can then output the date from the results:

Hope that helps.

Thanks,
Dan

1 Like
(Galaxy Lam) #3

Hi Daniel or other friends, when I used MySQL - Get a Row, I can connect it with database and test connection without problem, but I couldn’t go to the page that select table and column name, it can be reached before, but seems it’s missing now. After I typed MySQL information, I can only “SAVE”, but I can’t go to next step to enter Table, Column name and Value.

May you please advise ? Many thanks.

(Sarah Palombo) #4

Sorry about this:pensive:, I believe this should be resolved if you wouldn’t mind trying this again I think this should be sorted :+1:

1 Like
(Galaxy Lam) #5

Thanks Sarah, it works again :smiley:

1 Like