dongxun6690 2013-04-08 09:27
浏览 99

在MySQL和PHP中按ID显示特定列

I have problem (i think for you is simple to solve) with PHP and MySQL. I have database, that call "tekst". There is 3 column:

  1. id (autoincrement),
  2. date (timestamp),
  3. tresc (text)

and the site: index.html. I want to paste code like that <?php echo "$id1"; ?> into index.html to display a column "treść" assigned to some "id".

Now I do like that:

$w = mysql_fetch_array(mysql_query("SELECT * FROM tekst WHERE id=5"));

echo $w['tresc'];

but when I have many records, it will be troublesome.

How to create MySQL Query to display what i want ? In one page i will have many ID's.

Please help Thanks

  • 写回答

3条回答 默认 最新

  • dpik71879 2013-04-08 09:29
    关注

    Try using mysql_fetch_row.

    example

    mysql_fetch_row(mysql_query("SELECT * FROM tekst WHERE id=1"));
    

    Official Document

    评论

报告相同问题?