Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>#Server Connection to MySQL: import MySQLdb conn = MySQLdb.connect(host= "localhost", user="root", passwd="newpassword", db="engy1") x = conn.cursor() try: x.execute("""INSERT INTO anooog1 VALUES (%s,%s)""",(188,90)) conn.commit() except: conn.rollback() conn.close() </code></pre> <p><strong>edit</strong> working for me:</p> <pre><code>&gt;&gt;&gt; import MySQLdb &gt;&gt;&gt; #connect to db ... db = MySQLdb.connect("localhost","root","password","testdb" ) &gt;&gt;&gt; &gt;&gt;&gt; #setup cursor ... cursor = db.cursor() &gt;&gt;&gt; &gt;&gt;&gt; #create anooog1 table ... cursor.execute("DROP TABLE IF EXISTS anooog1") __main__:2: Warning: Unknown table 'anooog1' 0L &gt;&gt;&gt; &gt;&gt;&gt; sql = """CREATE TABLE anooog1 ( ... COL1 INT, ... COL2 INT )""" &gt;&gt;&gt; cursor.execute(sql) 0L &gt;&gt;&gt; &gt;&gt;&gt; #insert to table ... try: ... cursor.execute("""INSERT INTO anooog1 VALUES (%s,%s)""",(188,90)) ... db.commit() ... except: ... db.rollback() ... 1L &gt;&gt;&gt; #show table ... cursor.execute("""SELECT * FROM anooog1;""") 1L &gt;&gt;&gt; print cursor.fetchall() ((188L, 90L),) &gt;&gt;&gt; &gt;&gt;&gt; db.close() </code></pre> <p>table in mysql;</p> <pre><code>mysql&gt; use testdb; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql&gt; SELECT * FROM anooog1; +------+------+ | COL1 | COL2 | +------+------+ | 188 | 90 | +------+------+ 1 row in set (0.00 sec) mysql&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload