this code is echoeing table the times i enter the reccord for a particular registration number.plx help me out!!!!

if(isset($_REQUEST["Submit"]))
{
 $Registration_num=$_REQUEST['reg_num'];
  $query1=mysql_query("SELECT * from medicines where Registration_num = '$Registration_num'") ;
  while($row=mysql_fetch_array($query1))
  {

$query="select * from medicines where Registration_num='$Registration_num'";
$result=mysql_query($query);
mysql_query($query);
echo "<table border=1>";
 echo "<br><tr><td><b> <font color='#CC66FF'>Id</td><td><b>Prescribed_med</td><td><b>allergic_med</td><td><b>Dosage_unit</td>";

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

 $pr_med= $row[1];
 $al_med=$row[2];
 $d_unit=$row[3];
 $Id=$row[0];

echo "<tr><td><input name='checkbox' type='radio' value=$Id></td><td>". $pr_med."</td><td>". $al_med."</td><td>".$d_unit."</td></tr>";
}

echo "</table>";

}

Recommended Answers

All 3 Replies

Member Avatar for rajarajan2017

Post in a clear format, the text looks irritating

this code is echoeing table the times i enter the reccord for a particular registration number.plx help me out!!!!
i want the table to show all the values just once for the particular record

Member Avatar for rajarajan2017

Execute your query in phpadmin sqleditor to confirm whether it returns 1 or more rows

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.