Me Again : MySQL FW help.. Trying to find the right Syntax

Me Again : MySQL FW help.. Trying to find the right Syntax

Postby Tekfreakz » Wed Jan 18, 2017 3: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.
Tekfreakz
 
Posts: 18
Joined: Wed Jan 11, 2017 4:43 pm

Re: Me Again : MySQL FW help.. Trying to find the right Syntax

Postby Colin Haig » Wed Jan 18, 2017 8: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
Colin Haig
 
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Re: Me Again : MySQL FW help.. Trying to find the right Syntax

Postby Tekfreakz » Thu Jan 19, 2017 1: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: Select all  Expand view

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: Select all  Expand view

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


 
Tekfreakz
 
Posts: 18
Joined: Wed Jan 11, 2017 4:43 pm

Re: Me Again : MySQL FW help.. Trying to find the right Syntax

Postby Tekfreakz » Thu Jan 19, 2017 2:16 pm

Code: Select all  Expand view


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?
Tekfreakz
 
Posts: 18
Joined: Wed Jan 11, 2017 4:43 pm

Re: Me Again : MySQL FW help.. Trying to find the right Syntax

Postby Tekfreakz » Thu Jan 19, 2017 2:43 pm

NEVERMIND (FOUND)
Tekfreakz
 
Posts: 18
Joined: Wed Jan 11, 2017 4:43 pm

Re: Me Again : MySQL FW help.. Trying to find the right Syntax

Postby Tekfreakz » Thu Jan 26, 2017 3: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: Select all  Expand view


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: Select all  Expand view


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
Tekfreakz
 
Posts: 18
Joined: Wed Jan 11, 2017 4:43 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 40 guests