我有一個信息表女巫只包含一個網頁的設置。如何獲得只有一列與MySQL的價值?
INFO
id
np (number of posts in one page)
ngbp (number of guestbook posts in one page)
title (title (header h1) of the website)
footer (text of the footer(copyright))
lat (latitude for the google maps)
lng (longitude for the google maps)
mail (email of the contact page)
什麼是獲得帖子數量的最佳方式?我從來沒有定義過從數據庫的唯一一行獲取值。
我一直用這個:
$sql="SELECT np FROM info WHERE id=".$id;
$result=mysql_query($sql);
while ($row = mysql_fetch_assoc($result))
$numberofposts=$row['np'];
我應該用這個與WHERE id=1
?或者什麼是獲得該專欄價值的最佳方式?