Jump to content

help on array database records

- - - - -

  • Please log in to reply
2 replies to this topic

#1
mutago

mutago

    Programmer

  • Members
  • PipPipPipPip
  • 101 posts
Good day everyone, please i can display database records as follow in coldfusion
and now i want display it using an array in coldfusion as showed below in php code any help please.
below is the working code

<cfquery name="result" datasource="mydsn">


SELECT name,age,sex FROM data_record

</cfquery>

<h1><font color=green>data successfully selected</font></h1>

<cfoutput>

<b>Your Name is</b> #name#<br>

<b>Yoour age is</b> #age#<br>

</cfoutput>




Finally, in php i can do it this way


while($rows=mysql_fetch_array($result)){


?>

<b>name</b><? print $rows['name']; ?><br>

<b>Age:</b><? print $rows['age']; ?><br>

<b>sex:</b><? print $rows['sex']; ?><br>





#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,822 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
PHP is using an associative array to represent the records. ColdFusion uses a loop over the query object. You access members using either #name# or #query.name#.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
mutago

mutago

    Programmer

  • Members
  • PipPipPipPip
  • 101 posts
thanks




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users