Hey all...

I am getting a numrows count of -1 when I print numrows (see line 23 of the
code).   What does "-1" mean?    I think my connection is working and my
table has data.

Here's my code...

#!/usr/bin/python
# -*- coding: utf-8 -*-

import mysql.connector
from mysql.connector import errorcode

try:
  con = mysql.connector.connect(user='root', password='pw848596',
                              host='127.0.0.1',
                              database='mydb')
except mysql.connector.Error as err:
  if err.errno == errorcode.ER_ACCESS_DENIED_ERROR:
    print("Something is wrong with your user name or password")
  elif err.errno == errorcode.ER_BAD_DB_ERROR:
    print("Database does not exists")
  else:
    print(err)
else:
  cur=con.cursor()

  cur.execute("select Name from Rosters")
  numrows = cur.rowcount
  print numrows
  for x in xrange(0,numrows):
      row = cursor.fetchone()
      print "Name"

con.close()
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to