我的表被命名为pank
我知道如何连接到数据库但是下面的编程给我带来了问题
我的桌子是:
id| stream | title | cast | director
1 | stream1 | title of the movie1 | cast1 | director1
2 | stream1 | title of the movie2 | cast2 | director2
3 | stream2 | title of the movie3 | cast3 | director3
我的 PHP 脚本:
$query = "SELECT * FROM pank";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result))
{
echo "<h2>".'Stream : ', $row['stream'], "</h2>",
"<br />",
"<h3>", 'Title of the movie : ', $row['title'], "</h3>",
"<h3>", 'cast : ', $row['cast'], "</h3>",
"<h3>", 'director : ', $row['director'], "</h3>"
;
}
我想要输出为:
stream1
title of the movie1
cast1
director1
title of the movie2
cast2
director2
stream 2
title of the movie3
cast3
director3
上面的 php 给出的输出为:
stream1
title of the movie1
cast1
director2
stream1
title of the movie2
cast2
director2
stream2
title of the movie 3
cast3
director3
我只是不想第二次再次将输出标记为stream1