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

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

Postby Tekfreakz » Mon Feb 06, 2017 4:48 pm

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

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

Postby Tekfreakz » Thu Feb 09, 2017 3:58 pm

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  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+"'"

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

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

Postby Tekfreakz » Thu Feb 09, 2017 4:35 pm

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  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+"'"
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




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

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

Postby nageswaragunupudi » Thu Feb 09, 2017 9:19 pm

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 116 guests