Did you echo out $CharacterName before your SQL statement to ensure that it
is being set?   Or your $SQL variable before calling odbc_do?  This might
provide you with some insight as to why the query doesn't return anything.

HTH

Sam Masiello
Systems Analyst
Chek.Com
(716) 853-1362 x289
[EMAIL PROTECTED]

 -----Original Message-----
From:   Jeff Pearson [mailto:[EMAIL PROTECTED]]
Sent:   Friday, May 18, 2001 1:05 PM
To:     php
Subject:        [PHP] Blank Field Values

OK. Ive been beating my head over this code for a bit. I would appreciate it
if a fresh set of eyes would take a look at this for me. I have the
following code;

<SCRIPT language="PHP">
$connection = odbc_pconnect("XXXXXXX","XXXXX","XXXXXXX");
$SQL = "SELECT * FROM Bios WHERE CharacterName = '";
$SQL .= $CharacterName;
$SQL .= "'";
$QueryResult = odbc_do($connection, $SQL);
$NumberofRows = odbc_num_rows($QueryResult);
$ID = odbc_result($QueryResult, ID);
$NumberofFields = odbc_num_fields($QueryResult);
if ($NumberofRows != 0)
{
        $counter = 1;
        do
        {
                $CurrentFieldName = odbc_field_name($QueryResult, $counter);
                $CurrentFieldValue = odbc_result($QueryResult, $CurrentFieldName);
                echo $CurrentFieldName;
                echo "=";
                echo $CurrentFieldValue;
                echo ",";
                $counter = $counter + 1;
        }
        while ($counter <= $NumberofFields);
        echo "endoffields=end";
}
else
{
        echo "No records for that character";
}
</SCRIPT>









It results in the following output;

ID=,CharacterName=,RealName=,FormerAlias=,CurrentAlias=,FormerOccupations=,C
urrentOccupation=,MilitaryExperience=,Education=,LegalStatus=,Identity=,Plac
eofOrigin=,MaritalStatus=,KnownRelatives=,KnownConfidants=,Pets=,KnownAllies
=,MajorEnemies=,BaseofOperations=,Transportation=,PastGroupAffiliates=,Curre
ntGroupAffiliates=,Income=,Height=,Weight=,EyeColor=,HairColor=,OtherFeature
s=,IntelligenceLevel=,Strength=,SpeedReactions=,Stamina=,Agility=,FightingSk
ills=,SpecialSkills=,Handicaps=,OtherPowersandSkills=,Background=,endoffield
s=end



If I run the query with Access, it comes up with the expected row of
information I'm looking for. Can anyone see why Im getting empty values
back?


Any help would be GREATLY appreciated.

Jeff Pearson


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to