Here is my problem:
<?php
$sql = "SELECT Users.Name, Users.CompanyId, Company.CompanyId,
"Company.Name FROM Users, Company WHERE ".
"Users.CompanyId = Company.CompanyId AND Users.Id='79'";
$res = odbc_query($sql);
$strXml = "";
while ($result = odbc_fetch_row($res)) {
$nf = odbc_num_fields($res)+1;
for($count=1; $count < $nf; $count++) {
$field_name = odbc_field_name($res, $count);
$field_value = odbc_result($res, $count);
$strXml .= "<".strtolower($field_name).">".
$field_value."</".strtolower($field_name).">\n";
}
}
echo $strXml;
?>
Results:
<name>John</name>
<companyid>3</companyid>
<companyid>3</companyid>
<name>IBM</name>
I would like to make a string that looks like this:
<users-name>John</users-name>
<users-companyid>3</users-companyid>
<company-companyid>3</companyid>
<company-name>IBM</company-name>
So I want to fetch the table names in the same way as is
done for column names with using odbc_field_name().
Is there any way to do this with table names?
If anyone has had the same problem, please would you
be kind and reply this message...