<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2800.1515" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=083131218-21092005><FONT face=Arial
color=#0000ff size=2>I solved my initial error message, and I'm sure you all
caught the fact that I left out the $rs->MoveNext() command in my original
code...that was an oversight in the email. So this is the new code that I
have gotten to work as far as returning the actual column
datatype...</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=083131218-21092005><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=083131218-21092005>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=710011117-21092005>ADOLoadCode('mssql');<BR>$db =
ADONewConnection('mssql');<BR>$db->debug =
false; <BR>$db->connect(dbserver,userid,password,dbname);</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff
size=2>$db->SetFetchMode(ADODB_FETCH_ASSOC);</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2>$sql = "<SPAN
class=710011117-21092005> </SPAN>select * from <SPAN
class=710011117-21092005>table </SPAN>where <SPAN
class=710011117-21092005>column</SPAN> = <SPAN
class=710011117-21092005>'someval' ";</SPAN><BR>$rs =
$db->Execute($sql);<BR>while (!$rs->EOF) {</FONT></DIV>
<DIV><SPAN class=083131218-21092005><FONT face=Arial color=#0000ff
size=2> $count = count($rs->fields);</FONT></SPAN></DIV>
<DIV><SPAN class=083131218-21092005> <FONT face=Arial
color=#0000ff size=2>for ($i = 0; $i < $count; $i++) {</FONT></SPAN></DIV>
<DIV><SPAN class=083131218-21092005>
<FONT face=Arial color=#0000ff size=2>$fld =
$rs->FetchField($rs->fields($i));</FONT></SPAN></DIV>
<DIV><SPAN class=083131218-21092005>
<FONT face=Arial color=#0000ff size=2>if ($fld->type == "bit")
{</FONT></SPAN></DIV>
<DIV><SPAN
class=083131218-21092005>
<FONT face=Arial color=#0000ff size=2>//work with this field</FONT></SPAN></DIV>
<DIV><SPAN class=083131218-21092005>
<FONT face=Arial color=#0000ff size=2>}else{</FONT></SPAN></DIV>
<DIV><SPAN
class=083131218-21092005>
<FONT face=Arial color=#0000ff size=2>//ignore these other
fields</FONT></SPAN></DIV>
<DIV><SPAN class=083131218-21092005>
<FONT face=Arial color=#0000ff size=2>}</FONT></SPAN></DIV>
<DIV><SPAN class=083131218-21092005> <FONT face=Arial
color=#0000ff size=2>}</FONT></SPAN></DIV>
<DIV><SPAN class=083131218-21092005> <FONT face=Arial
color=#0000ff size=2>$rs->MoveNext();</FONT></SPAN></DIV>
<DIV><SPAN class=083131218-21092005><FONT face=Arial color=#0000ff
size=2>}</FONT></SPAN></DIV>
<DIV><SPAN class=083131218-21092005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=083131218-21092005><FONT face=Arial color=#0000ff size=2>what I
want however, is to be able to determine the datatype of the column from a
callback using array_filter, however this is what I get when I run the
following...</FONT></SPAN></DIV>
<DIV><SPAN class=083131218-21092005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=083131218-21092005><FONT face=Arial color=#0000ff size=2>echo
array_filter($rs->fields,"getTypes");</FONT></SPAN></DIV>
<DIV><SPAN class=083131218-21092005><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=083131218-21092005><FONT face=Arial color=#0000ff
size=2>function getTypes($var) {<BR> echo
"<pre>\n";<BR> var_dump($var);<BR>
echo "</pre>\n";</FONT></SPAN></DIV>
<DIV><SPAN class=083131218-21092005><FONT face=Arial color=#0000ff
size=2>}</FONT></SPAN></DIV></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV><PRE>int(2)
</PRE><PRE>string(15) "928 "
</PRE><PRE>int(1)
</PRE><PRE>int(1)
</PRE><PRE>int(1)
</PRE><PRE>int(1)
</PRE><PRE>int(0)
</PRE><PRE>int(0)
</PRE><PRE>int(0)
</PRE><PRE>int(0)
</PRE><PRE>int(0)
</PRE><PRE>int(0)
</PRE><PRE>int(0)
</PRE><PRE>int(0)
</PRE><PRE>int(0)
</PRE><PRE>NULL
</PRE><PRE>NULL
</PRE><PRE>NULL
</PRE><PRE>NULL
</PRE><PRE>NULL
</PRE><PRE>NULL
</PRE><PRE>string(19) "2005-09-16 12:20:53"
</PRE><PRE>string(19) "2005-09-16 12:20:53"
</PRE><PRE><SPAN class=083131218-21092005>so obviously, it is passing the value of the array at that index instead of the field object itself...is there another way to go about this?</SPAN></PRE></DIV>
<DIV><BR></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> ciapug-bounces@cialug.org
[mailto:ciapug-bounces@cialug.org] <B>On Behalf Of </B>Mark
Mikkelson<BR><B>Sent:</B> Wednesday, September 21, 2005 12:24 PM<BR><B>To:</B>
ciapug@cialug.org<BR><B>Subject:</B> [ciapug] Question on MetaType in adodb
lib<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT face=Arial size=2><SPAN class=710011117-21092005>I have a recordset
that I would like to be able to filter based on the MetaType value of the
current field, so that I can display information that is only stored in "bit"
fields instead of all the other info that I pulled into my recordset for
purposes elsewhere in the code. Does anyone know of a way to do
this? Here is what I have tried so far...</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=710011117-21092005></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=710011117-21092005>ADOLoadCode('mssql');<BR>$db =
ADONewConnection('mssql');<BR>$db->debug =
false; <BR>$db->connect(dbserver,userid,password,dbname);</SPAN></FONT></DIV>
<DIV><FONT face=Arial
size=2>$db->SetFetchMode(ADODB_FETCH_ASSOC);</FONT></DIV>
<DIV><FONT face=Arial size=2>$sql = "<SPAN class=710011117-21092005>
</SPAN>select * from <SPAN class=710011117-21092005>table
</SPAN>where <SPAN class=710011117-21092005>column</SPAN> = <SPAN
class=710011117-21092005>'someval' ";</SPAN><BR>$rs =
$db->Execute($sql);<BR>while (!$rs->EOF) {</FONT><FONT size=+0><BR><FONT
face=Arial><FONT size=2><SPAN class=710011117-21092005>
</SPAN>foreach ($rs->fields as $k => $v) {<BR><SPAN
class=710011117-21092005> </SPAN>if
($db->MetaType($rs->fields[$k]<SPAN class=710011117-21092005>)</SPAN> ==
"L") {<SPAN class=710011117-21092005> //failure on this
line: Call to undefined method ADODB_mssql::MetaType()</SPAN><BR><SPAN
class=710011117-21092005>
</SPAN>echo $v . "<hr />\n";<BR><SPAN
class=710011117-21092005></SPAN><SPAN
class=710011117-21092005> </SPAN>}<BR><SPAN
class=710011117-21092005>
</SPAN>}<BR>}</FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV>
<DIV align=left><STRONG><EM><FONT face=sylfaen>Mark
Mikkelson</FONT></EM></STRONG></DIV>
<DIV align=left><FONT face=sylfaen size=2>MCSA Messaging, CIW
Professional</FONT></DIV>
<DIV align=left><FONT face=sylfaen size=2>Web Specialist</FONT></DIV>
<DIV align=left><STRONG><EM><FONT face=sylfaen size=2><A
href="mailto:mikkelson_mt@msn.com">mikkelson_mt@msn.com</A></FONT></EM></STRONG></DIV></DIV></BODY></HTML>