Jump to content


Photo

echo out a value from a table


  • Please log in to reply
2 replies to this topic

#1 sdaniels

sdaniels
  • Members
  • PipPipPip
  • Advanced Member
  • 46 posts

Posted 12 April 2006 - 05:35 AM

I dont know why im having this issue but anyhow

will someone wite an example of how to select some data from a table and echo it out.

im allready connected to the database
i'v allready set up the query
$query = "SELECT whatever FROM wehrever WHERE something = 'yadda' AND something else = 'yadda";
@mysql_query($query);
now i want to echo out just one cell from the table...
what needs to be done?

#2 bonaparte

bonaparte
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts
  • Location#172, I Floor, 'Hamsashree', Defence Colony, Sahakaranagar, Bangalore, India

Posted 12 April 2006 - 06:45 AM

$result = mysql_query($query) ;
$line = mysql_fetch_array($result, MYSQL_ASSOC);
echo $line['whatever'];



#3 BladeMetal

BladeMetal
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 12 April 2006 - 08:49 AM

where 'whatever' equals the field name in your database




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users