RE: [PHP] Blank Field Values

2001-05-18 Thread Sam Masiello


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(XXX,X,XXX);
$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]




Re: [PHP] Blank Field Values

2001-05-18 Thread Bass???

Sam Masiello [EMAIL PROTECTED] ?
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 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(XXX,X,XXX);
 $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);

I don't know the exact solution , but I think it's the problem of the above
line since only
var $CurrentFieldValue  can't be displayed .
Have you try
$CurrentFieldValue = odbc_result($QueryResult, $counter);
and see if it works . ^_^


 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]




-- 
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]