I'm looking for the equivalent, in MySQL, of the javascript function encodeURIComponent() (http://www.w3schools.com/jsref/jsref_encodeURIComponent.asp) but can't find it. Anybody knows if such a function exist in MySQL?
Asked
Active
Viewed 415 times
1 Answers
0
Try this python code
import MySQLdb
import urllib
db = MySQLdb.connect(host=" ", # your host, usually localhost
user=" ", # your username
passwd=" ", # your password
db=" ") # your database name
cur = db.cursor()
cur.execute("SELECT column_name FROM table_name")
for row in cur.fetchall():
a = {row[1][:15]:row[1][15:]}
b = urllib.urlencode(a)
print(b)
query="Update table_name set column_name ='" + b + "' where id=" + str(row[0]) +';'
cur.execute(query)
db.commit()
db.close()

Community
- 1
- 1

Ayushi Dwivedi
- 7
- 3