FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Me Again : MySQL FW help.. Trying to find the right Syntax
Posts: 18
Joined: Wed Jan 11, 2017 04:43 PM
Me Again : MySQL FW help.. Trying to find the right Syntax
Posted: Wed Jan 18, 2017 03:22 PM

Alright so far my First Program in FiveWin is going rather smoothly..
Right now, im trying to figure out a way, (not show a row) but Seek column 'members' and finding UserID and Password.
To locate them and pass through to my next dialogs. (this part of the program does not use the DataBase Root, Which is connecting fine).

Anyone got the time to throw out a quick howto . Be amazing..

Thanks in Advance.

Posts: 310
Joined: Mon Oct 10, 2005 05:10 AM
Re: Me Again : MySQL FW help.. Trying to find the right Syntax
Posted: Wed Jan 18, 2017 08:03 PM

Hi

"select * from tablename where userid = '"+cUserId+"'"
if tablename.rowcount > 0
fnCheckPassword()
else
MsgInfo('User Not Found')
endif

Hope this is what you meant.

Colin

Posts: 18
Joined: Wed Jan 11, 2017 04:43 PM
Re: Me Again : MySQL FW help.. Trying to find the right Syntax
Posted: Thu Jan 19, 2017 01:46 PM
Colin Haig wrote:Hi

"select * from tablename where userid = '"+cUserId+"'"
if tablename.rowcount > 0
fnCheckPassword()
else
MsgInfo('User Not Found')
endif

Hope this is what you meant.

Colin



Can you explain this a little more..
i did a quick test of this, changed tablename to (members) where username = " ' +cUser+ ' " "
How ever when using members.rowcount > 0 (> is not a sign, to compile aparently) => works. i understand you did fnCheckPassword() : is a function to goto..
and blow out if not found.

Heres what i got.
Code (fw): Select all Collapse
cSql :=  "select * from members where username '"+cName+"'"
//This goes through fine.



cSql := "select * from members where username '"+cName+"'"
Now how ever, when im trying to pass the cName (the one that is typed in the GET)

im trying to look on Members table , ID, username, password.
to pass through as found and true and once it is seen and is true, to close my dialog, and bring syou to the next dialog (profile) possibly.

Im unsure how to check for this.. Should i be looking for Members row, ID? then check for username.. if so.. can i get an example ?

For new people:
"Not trying to connect to the database, im trying to create a login from using the tables in the database like you would with PHP Login on a website, only no php
involved.

Thank you! in advance

Update: This is what ive recently tried to do..
Code (fw): Select all Collapse
IF oCn == NIL
   msginfo( "oCn = Nil .. No Connection" )
   RETURN NIL
ENDIF
? "Query Loading"

//cSql := "SELECT * FROM `members` WHERE `username`" , { cName }
cSql :=  "select * from members where username '"+cName+"'"
//cSql := "SELECT * FROM `members` WHERE `id' = '"+cName+"'"

? "not the break"

if oCn:tableSet ( cSql ) = cName
   ?"Scream"
else
   ?"fart"
endif
Posts: 18
Joined: Wed Jan 11, 2017 04:43 PM
Re: Me Again : MySQL FW help.. Trying to find the right Syntax
Posted: Thu Jan 19, 2017 02:16 PM
Code (fw): Select all Collapse
IF oCn == NIL
   msginfo( "oCn = Nil .. No Connection" )
   RETURN NIL
ENDIF
? "Query Loading"

//cSql := "SELECT * FROM `members` WHERE `username`" , { cName }
cSql :=  "select * FROM members"
//cSql := "SELECT * FROM `members` WHERE `id' = '"+cName+"'"

? "not the break"








// oRsUser  := oCn:( "SELECT * FROM members WHERE 2" )

oRsUser  := oCn:RowSet(cSql)
?"test"

xbrowse(oRsUser)


Select * FROM finds the tables, Returns the information.. But tyring to find Just the Username like this
Select * From members Where username Does not return the value.

Where do i go from here?
Posts: 18
Joined: Wed Jan 11, 2017 04:43 PM
Re: Me Again : MySQL FW help.. Trying to find the right Syntax
Posted: Thu Jan 19, 2017 02:43 PM

NEVERMIND (FOUND)

Posts: 18
Joined: Wed Jan 11, 2017 04:43 PM
Re: Me Again : MySQL FW help.. Trying to find the right Syntax
Posted: Thu Jan 26, 2017 03:52 PM
Uh oh.. okay im trying to check both User and Password.

It works looking for user..
i have it then sending to _checkPass()

with in check pass, i tried to do the same look for the password as the user name, How ever, it only find 1 that works but still finds the user.
but if use example tekfreakz : nicole it says its not there, but if i use

tekfreakz:test (the first row of the member password) it works. o.o what the heck?

Code (fw): Select all Collapse
IF oCn == NIL
   msginfo( "oCn = Nil .. No Connection" )
   RETURN NIL
ENDIF

cSql2 := "select * from members where password = '"+cPassword+"'"


if cPassword < cSql2
   ?"no password found"
   RETURN NIL
else
   ?"Connected"
   oDlg:END()
   _dashboard()
endif

Password checker


First Checker:
Code (fw): Select all Collapse
IF oCn == NIL
   msginfo( "oCn = Nil .. No Connection" )
   RETURN NIL         
ENDIF                 
*? "Query Loading"    
                      
//Look For User Name  
cSql := "select * from members where username = '"+cName+"'"
                      
                      
                      
ros := oCn:RowSet(cSql)
                      
                      
if cName < cSql       
   ?"no user found"   
   RETURN NIL         
else                  
   _checkpass(oDlg,@cName,@cPassword,oName,oPassword)
endif
                      
                      
                      

Return Nil


Let me know if there should be a better way checking

Continue the discussion