Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

ring MySQL Save Image inside the database

See "Read file" + nl
cFile = read("testsmahmoud.jpg")
con = mysql_init()
See "Connect to database..." + nl
mysql_connect(con, "localhost", "root", "root","mahdb")
See "Escape string..." + nl
cFile = mysql_escape_string(con,cFile)
stmt = "INSERT INTO photo(id, data) VALUES(1, '" + cFile + "')"
See "Insert data..." + nl
mysql_query(con,stmt)
See "Close database..." + nl
mysql_close(con)
Source by ring-lang.github.io #
 
PREVIOUS NEXT
Tagged: #ring #MySQL #Save #Image #database
ADD COMMENT
Topic
Name
6+2 =