誰かがこれで私を助けてください
データベース内のエントリの数を数え、それらを正しく並べ替えたいと思います。このウェブサイトのようにwww.songglyrics.com
どんな助けでも大歓迎です。
SELECT COUNT(*) FROM TABLE
エントリー数をお知らせします。「正しく並べ替える」とはどういう意味ですか? その他の例については、MySQL のドキュメント ページを参照してください。
カウント :
Select Count(*) from table
選別 :
Select * from table order by songname asc/desc
songname はどのフィールドでもかまいません
この関数を使用して、やりたいことを実行できます。データベースへの接続に問題はありませんか?
**function select_query($fields,$tables,$where="",$order_by="",$group_by="",$having="",$limit="") {
$sql_stat=" select $fields from $tables ";
if (!empty($where)) $sql_stat.="where $where ";
if (!empty($group_by)) $sql_stat.="group by $group_by ";
if (!empty($order_by)) $sql_stat.="order by $order_by ";
if (!empty($having)) $sql_stat.="having $having ";
if (!empty($limit)) $sql_stat.="limit $limit ";
return mysql_query($sql_stat) or mysql_error().",".mysql_errno();
}**
それを解釈していただければ幸いです。