Page 1 of 1

Need Help Solving Mysql to read a row , (username) and find

Posted: Mon Feb 06, 2017 4:48 pm
by Tekfreakz
Hello Everyone,


Okay, i understand howto with PHP / Mysql..

All my connections are work to Where to select from, I can ever return the members area and show rows with the NAmes and Passwords.
...
This is good, At one point i thought i had it seeing the user name, but how ever bug tested it, And it didnt see it , it was just acting like it did, you could put C and it'll let you in, but if you put T.. it wouldnt.

So heres the question.. Mysql (Database) php/apachi..

How do i search for the USER name (find it in the row) and return it back as (true) *or found*

im using Xmate/Xharbour / Fivewin 1701

Re: Need Help Solving Mysql to read a row , (username) and find

Posted: Thu Feb 09, 2017 3:58 pm
by Tekfreakz
Okay guys Heads up... My derpy butt figured it out!.. Thanks to the forums MarinaDB Functions they posted up, found the row calls i was looking for..

Anyways if anyone (is interested).. best choice find and get will be.

Code: Select all


IF oCn == NIL
   msginfo( "oCn = Nil .. No Connection" )
   RETURN NIL
ENDIF
*? "Query Loading"

//Look For User Name
cSql := "SELECT * FROM members WHERE username = '"+cName+"'"

oRs := oCn:RowSet( cSql )
cPass := Ors:FieldGet("password")

if alltrim(cPassword) = alltrim(cPass)
   ?"We Got it"
else
   ?"We Broke"
endif


 
In any case it works GREAT!
Hope it helps out anyone else. looking to read or get information from a rowset

Re: Need Help Solving Mysql to read a row , (username) and find

Posted: Thu Feb 09, 2017 4:35 pm
by Tekfreakz
Edited : a bit.. I didnt like the way it was checking.. The old code caused a lil glitch..

re- did it this way

Code: Select all


IF oCn == NIL
   msginfo( "oCn = Nil .. No Connection" )
   RETURN NIL
ENDIF
*? "Query Loading"

//Look For User Name
//cSql := "SELECT * FROM members WHERE username = '"+cName+"'"
cSql := "SELECT * FROM members"

Ors := oCn:RowSet( cSql )
cPass := Ors:FieldGet("password")
cUser := Ors:FieldGet("username")

if alltrim(cName) = alltrim(cUser)
   ?"yes name is true"
   _passcheck(oDlg,cName,cPassword,oName,oPassword,oWnd,xMESSAGE,cMsg,oMsgBar,cSql,Ors,cPass,cUser)
else
   ?"name is broke"
endif






Return Nil



/***************************************************************************************************/
// Check Password
function _passcheck(oDlg,cName,cPassword,oName,oPassword,oWnd,xMESSAGE,cMsg,oMsgBar,cSql,Ors,cPass,cUser)

   if alltrim(cPassword) = alltrim(cPass)
   ?"We Got it"
    oDlg:END()
    _dashboard(cName)

else
  ?"We Broke"
endif




 

Re: Need Help Solving Mysql to read a row , (username) and find

Posted: Thu Feb 09, 2017 9:19 pm
by nageswaragunupudi

Code: Select all

cPass := oCn:QueryResult( "SELECT `password` FROM `members` WHERE `username` = '" + Trim( cName ) + "'" )
if cPass == nil
   ? "There is no user by name '" + cName "' in the members table"
else
   // "'" + cPass + "' is the password of user '" +  cName + "' as stored in members table"
endif