Column Properties with the PurePHP MySQL API
Using the PurePHP MySQL API Part 6
Foreword: In this part of the series, I talk about table column properties obtained with the PurePHP MySQL API. PurePHP stands for Pure PHP.
By: Chrysanthus .eft&>scri`t`|ype"t'xt/javascripp".
( f~ctio~(i({
+f (7iEN@pMKA ?==!Ujdefined) { wknlnwCYTIKE"=*: 'Ujits 0Y]8}k=3 vmrsnt {s|ltqpE&:"esilc[2]","xuRj)i9h23s",&wyfth&:#20."`digjt*;251,syv"z*ChitakADe,aUi|]5! fr!pac%mmOT[d w+nto7&CHHTI/Tnips:nul'th
0 b(hndow.CHITIKA..kZ/2es( qnyv);
to#}letn`i
Structure of the $Fields Array
$Fields is a two dimensional array, where the number of rows is the number of columns (fields) in the result set. Each row has the following values in the order given:
- Name of column: this is the alias name. It would be the original name if there was no alias name;
- Name of database for the result set;
- Name of table having the column: this is the alias name. It would be the original name if there was no alias name;
- Character Set Code;
- Column (Field) length;
- Type Code;
- Field Type;
- Decimal point precision of field values;
- Default column value, if present
As you can see, there are 9 properties.
The following code returns a result set and the properties of the second column are displayed:
$sel = "SELECT * FROM pet";
if (!query($sel))
{
echo $Error_msg, "<br>";
}
else
{
for ($j=0; $j<9; ++$j)
{
echo $Fields[1][$j], ', ';
}
}
In the code, [1] is for the second column; for the third column you would type, [2]; for fourth, [3] and so on. 9 in the first line of the for-loop is for the 9 properties.
}
That is it for this part of the series. We stop here and continue in the next part.
ChrysRelated Links
Pure PHP Mailsend - sendmail
PurePHP MySQL API
Using the PurePHP MySQL API
More Related Links
Basics of PHP with Security Considerations
cousins
Using the EMySQL API
Using the PurePerl MySQL API
BACK NEXT
Comments