logcomptechs Posted January 31, 2009 Share Posted January 31, 2009 (edited) I am trying to add a record to Username / Password Columns, when I add both Records, it will put the Record for Username on the first Row and the Record for Password it will put it on the second Row. But if I do this, then try to run a script to check a Username / Password, it would not work cause the Username would not have a password on the same row, same thing with the Password, not having a Username.This is the code I am using:$SQLInstance = _MySQLConnect($UserName,$Password,$Database,$MySQLServerName) _CreateTable($SQLInstance,'Login','Login') _CreateColumn($SQLInstance,'Login','Username') _CreateColumn($SQLInstance,'Login','Password') _AddRecord($SQLInstance,'Login','Username','test') _AddRecord($SQLInstance,'Login','Password','123') _MySQLEnd($SQLInstance)This is what my Database table looks like when I run the above code: Edited January 31, 2009 by logcomptechs Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 31, 2009 Share Posted January 31, 2009 I am trying to add a record to Username / Password Columns, when I add both Records, it will put the Record for Username on the first Row and the Record for Password it will put it on the second Row. But if I do this, then try to run a script to check a Username / Password, it would not work cause the Username would not have a password on the same row, same thing with the Password, not having a Username. This is the code I am using: $SQLInstance = _MySQLConnect($UserName,$Password,$Database,$MySQLServerName) _CreateTable($SQLInstance,'Login','Login') _CreateColumn($SQLInstance,'Login','Username') _CreateColumn($SQLInstance,'Login','Password') _AddRecord($SQLInstance,'Login','Username','test') _AddRecord($SQLInstance,'Login','Password','123') _MySQLEnd($SQLInstance) This is what my Database table looks like when I run the above code: You added two records and only gave half the data for each, so it worked as expected. It looks like passing multiple columns of data requires passing 1D arrays to it:$avColumns[2] = ['Username', 'Password'] $avData[2] = ['test', '123'] _AddRecord($SQLInstance,'Login', $avColumns, $avData) Otherwise, you'll have to add the record, then do a Query with an UPDATE statement to add data for additional columns. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
logcomptechs Posted January 31, 2009 Author Share Posted January 31, 2009 (edited) I got it to work, how you had the Array setup was not working so I just did it different way and it worked perfect, thank you! I did it this way: Dim $avColumns[2] Dim $avData[2] $avColumns[0] = "Username" $avColumns[1] = "Password" $avData[0]= "test" $avData[1] = "123" $SQLInstance = _MySQLConnect($UserName,$Password,$Database,$MySQLServerName) _CreateTable($SQLInstance,'Login','Login') _CreateColumn($SQLInstance,'Login','Username') _CreateColumn($SQLInstance,'Login','Password') _AddRecord($SQLInstance,'Login', $avColumns, $avData) _MySQLEnd($SQLInstance) Edited January 31, 2009 by logcomptechs Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 1, 2009 Share Posted February 1, 2009 I got it to work, how you had the Array setup was not working so I just did it different way and it worked perfect, thank you! I did it this way: Dim $avColumns[2] Dim $avData[2] $avColumns[0] = "Username" $avColumns[1] = "Password" $avData[0]= "test" $avData[1] = "123" $SQLInstance = _MySQLConnect($UserName,$Password,$Database,$MySQLServerName) _CreateTable($SQLInstance,'Login','Login') _CreateColumn($SQLInstance,'Login','Username') _CreateColumn($SQLInstance,'Login','Password') _AddRecord($SQLInstance,'Login', $avColumns, $avData) _MySQLEnd($SQLInstance) Syntax error on my part. Should have put "Global" (or Dim, though that is deprecated in AutoIt) in front of the array declarations. The syntax for setting the data on the same line with the declarations was otherwise correct though. My example should have been: Global $avColumns[2] = ['Username', 'Password'] Global $avData[2] = ['test', '123'] _AddRecord($SQLInstance,'Login', $avColumns, $avData) Glad you got it working. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now