Well I don't really know mySQL, PHP, com objects, or ADO, but I hacked together a !seen script anyways based on Hammer's work. I'm not sure why it works, but it works pretty well!

While I was trying to figure out how Hammer's code worked, I made some more goodies that might help others.

Here's a snippet...
Code:
  var %obj
  var %SQL = SELECT FirstName, LastName, Gender FROM Nicks WHERE nickname = ' $+ $1 $+ ';
  var %result = $mysql_query(%SQL,%DB), %success = $gettok(%result,1,32), %obj = $gettok(%result,2,32)
  if (%success) {
    echo %Success.Color -a * Opened MySQL QUERY connection: %SQL
    echo -a Returned: $mysql_fetch_field(%obj,1) $mysql_fetch_field(%obj,2) $mysql_fetch_field(%obj,3) 
    SQLcomclose %obj
  }
  else {
    echo %Failure.Color -a * Couldn't connect to MySQL for QUERY: %SQL
  }

That came from rewriting his 1st, simpler code, with his revised code. %DB is also the same as MySQL.Database or MySQL.Database.$ticks depending on where you copy paste.

And custom alias:
Code:
 
; NOT zero based, 1st column is column 1
ALIAS mysql_fetch_field {
  if ($com($$1, Collect, 2, i4, $calc($$2 - 1))) { return $com($$1).result  }
  else {
    ; ERROR: NO FIELD--OUT OF BOUNDS?
    return
  }
}
 


Now I'm trying to figure out how to get it to return stuff in a format I like. It's been returning integer data like "15" as "15.000000"

I tried different variable types: i1, i2, i4, ui1, ui2, ui4, int, uint, r4, r8, cy, date, decimal, bool, bstr, variant, dispatch, unknown, error (found in mIRC help for com objects) but nothing yet.

I know you didn't want to write a tutorial, but I've been trying to find documentation, especially on the syntax, with little luck.

[edit]I've found the MSDN reference, but it's just help me learn a lot more, but not how why it returns funny numbers.

Last edited by namnori; 16/07/05 04:44 AM.