jeff5656 Posted December 12, 2008 Share Posted December 12, 2008 I get this error: syntax error, unexpected '{', expecting ';' in C:\wamp\www\warren\billing\editdos.php on line 24 <?php do { echo $row['patient']; } while ($row = mysql_fetch_assoc ($result)) { echo "<tr><td>" . $row['patient'] . "</td><td>" . $row['mrn'] . "</td><td>" .$row['billing_date'] . "</td><td>" . $row['billing_lvl'] . "</td><td>" . $row['dx1'] . ", " . $row['dx1'] . ", " . $row['dx2'] . ", " . $row['dx3'] . ", " . $row['dx4'] . ", " . $row['dx5'] . ", " . $row['dx6'] . ", " . $row['dx7'] . ", " . $row['dx8'] . ", "; echo "</tr>"; } } ?> Link to comment https://forums.phpfreaks.com/topic/136677-solved-unexpected/ Share on other sites More sharing options...
rhodesa Posted December 12, 2008 Share Posted December 12, 2008 you are using do/while wrong it should probably be: <?php while ($row = mysql_fetch_assoc ($result)) { echo "<tr><td>" . $row['patient'] . "</td><td>" . $row['mrn'] . "</td><td>" .$row['billing_date'] . "</td><td>" . $row['billing_lvl'] . "</td><td>" . $row['dx1'] . ", " . $row['dx1'] . ", " . $row['dx2'] . ", " . $row['dx3'] . ", " . $row['dx4'] . ", " . $row['dx5'] . ", " . $row['dx6'] . ", " . $row['dx7'] . ", " . $row['dx8'] . ", "; echo "</tr>"; } ?> Link to comment https://forums.phpfreaks.com/topic/136677-solved-unexpected/#findComment-713658 Share on other sites More sharing options...
jeff5656 Posted December 12, 2008 Author Share Posted December 12, 2008 Then how do I echo $row['patient'] BEFORE the while loop (because it is the same in every row)? If I echo it before then the first record gets skipped when I do the while loop. See this output, patient is same so I want to put patient as a header before the table: Patient MRN Billing date Billing level Diagnoses brooks, jeffrey 8001188971 0000-00-00 hpl khkh, khkh, khkjh, jhkh, , , , , , brooks, jeffrey 8001188971 2008-12-09 consm copd, copd, chf, pneumonia, , , , , , brooks, jeffrey 8001188971 2008-12-10 hph , , , , , , , , , brooks, jeffrey 8001188971 2008-12-11 consl , , , , , , , , , Link to comment https://forums.phpfreaks.com/topic/136677-solved-unexpected/#findComment-713665 Share on other sites More sharing options...
Adam Posted December 12, 2008 Share Posted December 12, 2008 <?php while ($row = mysql_fetch_assoc ($result)) { echo "<tr><td>" . $row['patient'] . "</td><td>" . $row['mrn'] . "</td><td>" .$row['billing_date'] . "</td><td>" . $row['billing_lvl'] . "</td><td>" . $row['dx1'] . ", " . $row['dx1'] . ", " . $row['dx2'] . ", " . $row['dx3'] . ", " . $row['dx4'] . ", " . $row['dx5'] . ", " . $row['dx6'] . ", " . $row['dx7'] . ", " . $row['dx8'] . ", "; echo "</tr>"; } ?> You're echoing $row['patient'] within the loop? A Link to comment https://forums.phpfreaks.com/topic/136677-solved-unexpected/#findComment-713669 Share on other sites More sharing options...
jeff5656 Posted December 12, 2008 Author Share Posted December 12, 2008 Yes I am but I WANT to take patient out of the loop since it's the same for every record. Link to comment https://forums.phpfreaks.com/topic/136677-solved-unexpected/#findComment-713670 Share on other sites More sharing options...
rhodesa Posted December 12, 2008 Share Posted December 12, 2008 <?php for($n=0;$row = mysql_fetch_assoc ($result);$n++) { if(!$n){ echo $row['patient']; } echo "<tr><td>" . $row['patient'] . "</td><td>" . $row['mrn'] . "</td><td>" .$row['billing_date'] . "</td><td>" . $row['billing_lvl'] . "</td><td>" . $row['dx1'] . ", " . $row['dx1'] . ", " . $row['dx2'] . ", " . $row['dx3'] . ", " . $row['dx4'] . ", " . $row['dx5'] . ", " . $row['dx6'] . ", " . $row['dx7'] . ", " . $row['dx8'] . ", "; echo "</tr>"; } ?> Link to comment https://forums.phpfreaks.com/topic/136677-solved-unexpected/#findComment-713671 Share on other sites More sharing options...
jeff5656 Posted December 12, 2008 Author Share Posted December 12, 2008 Thanks! Link to comment https://forums.phpfreaks.com/topic/136677-solved-unexpected/#findComment-713675 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.