MySQL Error in Python
<blockquote>
  <p>I need to insert a record into the table MemberDetails but I end up with the error stating " _mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'I' at line 1") "</p>
</blockquote>

<pre><code>sql5="INSERT INTO MemberDetails VALUES"+"("+"'2016-2020','"+PhoneNum+"','VEC','"+Address+"','"+StuID+"','"+DOB+"','1000','"+Name+"','"+Pass+"','"+dept+"','"+year+"','"+sec+"')"    
cursor.execute(sql5)
</code></pre>

<p>You need to add spacing as well as the columns in the table each variable will be inserted into, your query should be like this:</p>

<pre><code>"INSERT INTO MemberDetails (datetime, phone, code, address, stuid, birthdate, num, name, pass, dept, year, sec) VALUES (" + "'2016-2020','" + PhoneNum + "','VEC','" + Address + "','" + StuID + "','" +DOB +"','1000','" + Name + "','" + Pass + "','" + dept + "','" + year + "','" +sec + "')" 
</code></pre>

<p>Just replace the variables in the first set of brackets with the column name you want each variable to be put into.</p>

python mysql