1

i need to add any function for my result id in EOF but i see this line in page and not work my function. how to fix this?!

{design_num('61')}

my PHP:

$stmt->bind_result($Id,$first_name, $last_name);

$content = <<< EOF
  <tr>
  <td style="text-align:center;">{design_num($Id)}</td> 
  <td style="text-align:right;"><a href="#">{$first_name}</td>
  <td style="text-align:right;">{$last_name}</td>
  </tr>                                                     
EOF;
B.B King
  • 111
  • 2
  • 3
  • 7
  • 1
    You do not close your `a` element. Moreover, please use `htmlspecialchars` when outputting `$first_name` and `$last_name` to avoid XSS. – Marcel Korpel Apr 01 '13 at 11:58
  • 1
    As Michael suggests, those `EOF` markers are being used as what is called HEREDOC markers. Just so you know for future googling. – jcbwlkr Apr 01 '13 at 12:18

1 Answers1

1

It's feasible, but you need a powerful magic to accomplish this task

$design_num = design_num($Id);
$content = <<< EOF
  <tr>
  <td style="text-align:center;">$design_num</td> 
  <td style="text-align:right;"><a href="#">$first_name</td>
  <td style="text-align:right;">$last_name</td>
  </tr>                                                     
EOF;
Your Common Sense
  • 156,878
  • 40
  • 214
  • 345