![](/img/trans.png)
[英]Using junction tables in PHP and MySQL to categorize and include and exclude categories
[英]how to categorize tables in php using arrays
我是 PHP 新手。 我正在创作歌本。
问题 1:我想创建按字母顺序排列歌曲列表的表格。 我不想为每个字母表创建 A.php、B.php、C.php。 我不知道该怎么做。 我知道如何用数组创建一个表。
<table>
<tbody>
<tr>
<td><?php echo $song; ?>
</td>
<td><a href="publicsearch.php?lyric=<?php echo $song; ?>"><?php echo $lyric["title"]; ?></a>
</td>
<td><?php echo $lyric["artist"]; ?>
</td>
</tbody>
</table>
问题 2:我想创建一个表,在另一个表中显示同一艺术家的结果。
////Arrays/////
/////song 197 - artist jackson////
"197" => array(
"title" => "a song with a id - 197",
"chords" => " ....",
"artist" => "jackson ",
"tags" => "unknown "
),
/////song 210 - with same artist jackson////
"210" => array(
"title" => "another song with different id - 210 in other table",
"chords" => " ....",
"artist" => "jackson",
"tags" => "unknown "
),
请帮帮我。
也许您应该尝试连接到 MySql、MS-SQL 或 PostGresql 等数据库,而不是查看 PHP 框架/库。 基于静态 PHP 数组的解决方案将不容易编辑。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.