@grindstone
i think I have broken FreeBASIC he he
Code: Select all
Dim SQLQuery As String
Dim db As MYSQL Ptr
Dim res As Integer
Dim restab As mysql_res Ptr
Dim row As mysql_row
SQLQuery = ""
SQLQuery += "select "
SQLQuery += "userid, " '0
SQLQuery += "userpassword, " '1
SQLQuery += "username, " '2
SQLQuery += "usernameposrecipit, " '3
SQLQuery += "changepassword, " '4
SQLQuery += "useraccesslevel " '5
SQLQuery += "from usertable "
SQLQuery += "where userid='" & CashierNumberLocal & "' and userpassword='" & CashierPasswordLocal & "';"
'Initialize the API. db points to the MySQL system.
db = mysql_init(NULL)
'Connect to the MySQL system.
IF( mysql_real_connect( db, ServerAddress, ServerUserName, ServerUserPassword, ServerDatabaseName, ServerDatabasePort, NULL, 0 ) = 0 ) THEN
PRINT "Can't connect to the mysql server on port"; MYSQL_PORT
mysql_close( db )
Sleep
End 1
END IF
'Select a data base.
If (mysql_select_db( db, ServerDatabaseName)) Then
Print "Can't select the "; ServerDatabaseName; "Color = teal>"" database !"
mysql_close(db)
Sleep
End 1
End If
'Print informations about the RDBMS host and the data base.
PRINT "Client info : "; *mysql_get_client_info()
PRINT " Host info : "; *mysql_get_host_info(db)
PRINT "Server info : "; *mysql_get_server_info(db)
'Submit a SQL query.
res = mysql_query(db, SQLQuery)
'Declare a pointer to the result table
IF res = 0 Then
If mysql_num_rows(restab) > 0 Then
restab = mysql_store_result(db)
row = mysql_fetch_row(restab)
Dim PasswordChange As Integer = *row[4]
Select Case PasswordChange
Case 0 'No Change required
KeyPadInput = ""
CashierNamePrint = Trim(*row[3])
CashierAccess = Trim(*row[5]) 'Set the system to use the signed on cashier
CashierOverrideAccess = 0
PriceOverridePrice = 0 'Clears the Entered Price
TotalDue = 0 'Resets sale value
ItemsSold = 0 'Resets item count
TotalTendered = 0 'Resert the total tendered value
RecipitClear = 1 'Set the recipit so a new one can be produced for sale
SaleMode = "Sale" 'Sets the salemode back to sale
'RecallInProgress = "No" 'Resets the Recall trigger so the system will run in normal mode
ShowTaskBarItems = 1
SubTotalPressed = 0
DisplayLine1 = ""
DisplayLine2 = ""
'Close the API access.
mysql_close(db)
Salescreen
Case 1 ' Password needs to be changed
mysql_close(db)
updateCashierScreen(CashierDisplayComSettings, "PASSWORD EXPIRED", 0, "PRESS CLEAR TO CHANGE" & KeyPadInPutPassword, 1, 0)
'PasswordChange1
End Select
Else
updateCashierScreen(CashierDisplayComSettings, "USER OR PASSWORD", 0, "NOT FOUND. PRESS CLEAR" & KeyPadInPutPassword, 1, 0)
Do : Dim KeyPress As Long = GetKeyNB
Select Case KeyPress
Case Key_Clear
KeyPadInput = ""
RequestCashierID
Exit Sub
End Select
Loop
End If
End If
it is put in ANY USER number and password i get a error box show up saying "FBtemp has stopped working" after it shows the following data
Client info : 6.1.11
Host info : 192.168.1.199 via TCP/IP
Server info : 5.5.60-0+deb8u1
have i miss used some of the code?