-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakeArticle.py
More file actions
45 lines (29 loc) · 928 Bytes
/
makeArticle.py
File metadata and controls
45 lines (29 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import mysql.connector
def makeArticle(Articles):
# Connect to the database
mydb = mysql.connector.connect(
host="localhost",
user="python",
password="Pyth0nDB!",
database="joannaDB")
# Adds TaasUser to mySQL DB
mycursor = mydb.cursor()
sql = "INSERT INTO articles " \
"(article_title, " \
"author_username," \
"author_verification," \
"article_text_path," \
"article_type," \
"article_texts,"\
"article_img)"\
"VALUES (%s, %s, %s, %s, %s, %s, %s)"
val = (Articles.article_title,
Articles.author_username,
Articles.author_verification,
Articles.article_text_path,
Articles.article_type,
Articles.article_texts,
Articles.article_img)
mycursor.execute(sql, val)
mydb.commit()
return "articleCreated"