0
$res=mysql_query("SELECT code_type,code,date,provider_id FROM billing WHERE encounter='$encounter' AND pid='$pid'");
while($row=mysql_fetch_array($res)){
$code_type=$row['code_type'];
$code=$row['code'];
$date=$row['date'];
$provider=$row['provider_id'];
$standard_code=$code_type.":".$code;
$res1=mysql_query("SELECT procedure_type_id FROM procedure_type WHERE standard_code='$standard_code'");
while($row1=mysql_fetch_array($res1)){
$procedure_type_id=$row1['procedure_type_id'];
mysql_query("INSERT INTO procedure_order(procedure_type_id,date_ordered,provider_id,date_collected,order_priority,order_status
,patient_instructions,patient_id,encounter_id) VALUES('$procedure_type_id','$date','$provider','$date','high','pending','$complaints','$pid','$encounter_id')")
or die(mysql_error());
}
}

The above query saves(inserts) more than once in the database. what can be the cause especially in the while loops ? please help me rectify.

2
Contributors
1
Reply
18
Views
4 Years
Discussion Span
Last Post by Webville312
0

I think, you are requesting the query to be executed; for as long as there are matching records in the database, just as stated in your code, right here;

while($row1=mysql_fetch_array($res1))

The code will insert records for as long as $res1 is returning records.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.