警告PHP oci_execute()和oci_fetch_row()

时间:2017-06-01 10:51:24

标签: php oracle

我想在php中显示我的数据库中的一些列。 我的PHP代码如下所示:

<?PHP
$conn=oci_connect('student', 'STUDENT', 'localhost/XE');
if(!$conn)
{ $c=oci_error();
  trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$stid=oci_parse($conn, "SELECT * FROM matches m JOIN teams tt ON m.id_team1=tt.team_id JOIN teams ttt ON m.id_team2=ttt.team_id");
oci_execute($stid);
echo "<table>\n";
while (($row = oci_fetch_row($stid)) != false) {
   echo "<tr>";
    echo "<td>".$row[9] ."<td>".$row[4]."</td>"."<td>".$row[5]."</td>"."<td>".$row[13]."</td>";
   echo " </tr>";
}
echo "</table>\n";
?>

我收到此错误:

  

Warning: oci_execute(): ORA-00911: invalid character in C:\Apache24\htdocs\finale.php on line 60 ( line 60= oci_execute($stid); )

     

Warning: oci_fetch_row(): ORA-24374: define not done before fetch or execute and fetch in C:\Apache24\htdocs\finale.php on line 62 ( while (($row = oci_fetch_row($stid)) != false) )

有人可以帮我吗?

1 个答案:

答案 0 :(得分:-1)

在您的代码中,您可能无法再次加入相同的表格。 "SELECT * FROM matches m JOIN teams tt ON m.id_team1=tt.team_id JOIN teams ttt ON m.id_team2=ttt.team_id"

团队出现了两次。