Mar-22-2020, 08:35 AM
(This post was last modified: Mar-22-2020, 08:40 AM by BrandonKastning.)
Update is as follows:
I have setup my MariaDB Database as follows (Couple changes):
Primary Key - opinion_ID / BIGINT / 8 / Unsigned / AUTO_INCREMENT
all_Title - VARCHAR / 250
all_Opinion - LONGTEXT
all_URL - VARCHAR / 250
and Modified the Python3 Variable -> MySQL INSERT to look like the following:
I have setup my MariaDB Database as follows (Couple changes):
Primary Key - opinion_ID / BIGINT / 8 / Unsigned / AUTO_INCREMENT
all_Title - VARCHAR / 250
all_Opinion - LONGTEXT
all_URL - VARCHAR / 250
and Modified the Python3 Variable -> MySQL INSERT to look like the following:
import mysql.connector from mysql.connector import Error def insertVariblesIntoTable(allTitle, allOpinion, allURL): try: connection = mysql.connector.connect(host='localhost', database='PythonMariaDB1', user='PythonMariaDB1', password='password1234') cursor = connection.cursor() mySql_insert_query = """INSERT INTO Single_No_Loop (all_Title, all_Opinion, all_URL) VALUES (%s, %s, %s) """ recordTuple = (allTitle, allOpinion, allURL) cursor.execute(mySql_insert_query, recordTuple) connection.commit() print("Record inserted successfully into Single_No_Loop table") except mysql.connector.Error as error: print("Failed to insert into MySQL table {}".format(error)) finally: if (connection.is_connected()): cursor.close() connection.close() print("MySQL connection is closed") insertVariblesIntoTable(2, 'Area 51M', 6999, '2019-04-14') insertVariblesIntoTable(3, 'MacBook Pro', 2499, '2019-06-20')What I am unsure of is the bottom lines:
insertVariblesIntoTable(2, 'Area 51M', 6999, '2019-04-14') insertVariblesIntoTable(3, 'MacBook Pro', 2499, '2019-06-20')My question is; can I disregard those lines as they do not pertain to my original script that I am implementing this into? Will the above be sufficient or are other modifications required?
“And one of the elders saith unto me, Weep not: behold, the Lion of the tribe of Juda, the Root of David, hath prevailed to open the book,...” - Revelation 5:5 (KJV)
“And oppress not the widow, nor the fatherless, the stranger, nor the poor; and ...” - Zechariah 7:10 (KJV)
#LetHISPeopleGo
“And oppress not the widow, nor the fatherless, the stranger, nor the poor; and ...” - Zechariah 7:10 (KJV)
#LetHISPeopleGo