Re: Blank Field Values

From: Date: Fri, 18 May 2001 21:12:12 +0000
Subject: Re: Blank Field Values
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-53487@lists.php.net to get a copy of this message
""Sam Masiello"" <smasiello@chekinc.com> ????? news:NEBBILMKALAOMJAKHKFOMEKKDHAA.smasiello@chekinc.com... > > 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 > smasiello@chekinc.com > > -----Original Message----- > From: Jeff Pearson [mailto:jeffpearson@paymentresource.com] > 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); 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: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#53487) next »