Reputation: 597
After adding this code:
<?php
foreach($emp as $empdata){
echo "<tr><td>".$empdata[emp_id]."</td><td>"."<a href="?>edit.php?emp_id=<?php echo $empdata[emp_id] ">".$empdata[emp_name]."</a></td></tr>";
} ?>
I get this:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/kumar/public_html/amsConcrete/single_pages/employee/show_employee.php on line 23
Any suggestions? Please
Upvotes: 0
Views: 1940
Reputation:
//This is more easier format
<?php
foreach($emp as $empdata){
?>
<tr>
<td><?php echo $empdata['emp_id'] ?></td>
<td><a href='edit.php?emp_id=<?php echo $empdata["emp_id"] ?>'><?php echo $empdata['emp_name'] ?></a></td>
</tr>
<?php } ?>
Upvotes: 0
Reputation: 3236
Try This. It should be work
<?php
foreach($emp as $empdata){
echo "<tr><td>".$empdata[emp_id]."</td><td><a href='edit.php?emp_id=". $empdata[emp_id]. "'>".$empdata[emp_name]."</a></td></tr>";
} ?>
Upvotes: 0
Reputation: 33522
It looks like something went a little funny in the middle of your output:
$empdata[emp_id]."</td><td><a href='edit.php?emp_id=".$empdata[emp_id]."'>".$empdata[emp_name]."</a></td></tr>";
I think this should do the trick though.
You don't need to run echo inside the string (in fact it's a bad thing). You can however just use the variables as they are - which you did for part of it, but not the other part.
Upvotes: 2