libmysql.dll MySQL
Posted: Sat Feb 26, 2005 8:19 pm
Hi, again.
Been having some trouble with using this lib..libmysql.dll..hoping someone here has experience using this.
I'm trying to get the value of ID and name from this query:
However, have failed miserably. This is the code im using at the moment:
Can anyone tell me whats wrong with this code? Or possibly post some other code which achieves the same desired affect with this lib?
Been having some trouble with using this lib..libmysql.dll..hoping someone here has experience using this.
I'm trying to get the value of ID and name from this query:
Code: Select all
SQL = "SELECT id,name FROM ibf_members WHERE name='"+Str(Username)+"'"
Code: Select all
SQL = "SELECT id,name FROM ibf_members WHERE name='"+Str(Username)+"'"
If CallFunction(#libmysql,"mysql_real_query", dbHnd, SQL, Len(SQL))
;GetError(dbHnd,1)
Debug "failed"
Else
Debug "ok"
*mysqlResult=CallFunction(#libmysql,"mysql_store_result",dbHnd)
affRows = CallFunction(#libmysql,"mysql_affected_rows",dbHnd)
fieldNum = CallFunction(#libmysql,"mysql_num_fields",*mysqlResult)
rowsNum = CallFunction(#libmysql,"mysql_num_rows",*mysqlResult)
Debug affRows
Debug fieldNum
Debug rowsNum
content.s=""
;row =
Debug "Field Number 1:"+Str(fieldNum)
For i=1 To rowsNum
*mysqlRow=CallFunction(#libmysql,"mysql_fetch_row",*mysqlResult)
*mysqlLen=CallFunction(#libmysql,"mysql_fetch_lengths",*mysqlResult)
For j=1 To fieldNum
length=PeekL(*mysqlLen+4*(j-1))
fieldptr=PeekL(*mysqlRow+4*(j-1))
If fieldptr>0
content.s=PeekS(fieldptr,length)
Else
;zero pointer returend means empty field
content="NULL"
EndIf
;row = row + content + ";"
Select j
Case 1
dbid.s=Str(content)
Case 2
name.s=Str(content)
EndSelect
Next j
Next i