I'm new to Python and MySQL. I have a database named examples in my localhost which has 3 columns.
mysql> select * from words;
+----+--------+------------------------------------+
| id | userid | inputs |
+----+--------+------------------------------------+
| 1 | aneesh | company's names wow!!! how? etc... |
+----+--------+------------------------------------+
1 row in set (0.00 sec)
The inputs
column can contain any characters (so i have given text
datatype)
I want to write a python code which takes all values (words numbers and special characters) from user input and store it in the inputs
column in the db without altering the previous values (like append in lists).
eg :-
raw_input("Enter Anything: ")
Enter Anything: (abcd) awesome!!! @aneesh #tags
Now the values in inputs
column should be
company's names wow!!! how? etc... (abcd) is awesome!!! @aneesh #tags
Yeah...and I want access those values as words separately so that I can further process it to compare and give error if user enters the word that already exists next time.
Any Idea how can I do that?
You can write and update statement and keep appending it with existing value.
Assuming v_input
is what you get from user input and for v_userid
UPDATE words SET inputs = CONCAT(inputs, v_input) WHERE userid =v_userid
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.