-2

when I run SELECT * FROM urlcheck
it returns 'EMPTY Set (0.0 sec)'
According SHOW TABLE STATUS LIKE 'urlcheck'
The table has 3 rows.
Table structure is:

+-------------+---------------+------+-----+---------+----------------+<br>
| Field       | Type          | Null | Key | Default | Extra          |<br>
+-------------+---------------+------+-----+---------+----------------+<br>
| id          | int(11)       | NO   | PRI | NULL    | auto_increment |<br>
| coursegroup | varchar(20)   | YES  |     | NULL    |                |<br>
| url         | varchar(2588) | YES  |     | NULL    |                |<br>
+-------------+---------------+------+-----+---------+----------------+<br>

I start by selecting the database with USE db
any ideas why this happened. I know this is similiar to Mysql select always returns empty setMysql select always returns empty set but that was apparently a corrupted database. I have truncated this database and add new rows and I still get the same problem. The code that adds records FWIW is

cur.execute('insert into urlcheck (coursegroup, url) values("'+coursegroup+'","'+url+'");')
db.commit
cur.close
The Impaler
  • 45,731
  • 9
  • 39
  • 76
rwreed
  • 348
  • 2
  • 10
  • Well, your table **is** empty, so you need to check your insert code. – Shadow Sep 18 '19 at 14:13
  • you should always make the effort and enter an errror handling to your code. Besides using prepared statements – nbk Sep 18 '19 at 16:40

1 Answers1

0

The problem was a syntax error in my code.
should have been:
db.commit()
cur.close()
lack of parentheses caused the code not to write. I leave this here even as it redounds to my own humiliation in the hopes it helps someone else.

rwreed
  • 348
  • 2
  • 10