-2

我尝试修复它,但仍然收到以下 Parse 错误:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE,
 expecting T_STRING or T_VARIABLE or T_NUM_STRING in

这是第 13 行:

<?php
  if ($fruitdata['fruit'] == "") {
    print "N/A <a href="./add.php?id=<?php print $fruitdata['id']; ?>">Edit</a>"; }
  else {
    print $fruitdata['fruit'];
  }
?>
4

2 回答 2

1

转义双引号并将字符串连接到变量:

<td><?php if ($fruitdata['fruit'] == "") { print "N/A <a href=\"./add.php?id=". $fruitdata['id']."\">Edit</a>"; } else { print $fruitdata['fruit']; } ?>
于 2013-04-13T15:33:28.340 回答
0

多个语法错误。这应该让你直截了当:

<td><?php
if ($fruitdata['fruit'] == "") {
    print 'N/A <a href=./add.php?id='.$fruitdata['id'].'">Edit</a>"';
}else{
    print $fruitdata['fruit'];
}?>
于 2013-04-13T15:34:45.863 回答