Jump to content


Photo

Is it possible to echo a specific record in a MySQL table based on its ID column?


  • Please log in to reply
1 reply to this topic

#1 adamjnz

adamjnz
  • Members
  • PipPipPip
  • Advanced Member
  • 30 posts

Posted 14 April 2006 - 03:46 AM

Is it possible to echo a specific record in a MySQL table based on its ID column?

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 14 April 2006 - 05:08 AM

Yes. Are you having problems?

<?php
$q = "select * from tablename where id='$somevariable'";
$rs = mysql_query($q) or die('Problem with the query: ' . $q . '<br />' . mysql_error());
$rw = mysql_fetch_assoc($rw);
echo '<pre>' . print_r($row,true) . '</pre>';
?>

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users