你是只取这一个值还是要取数组。只取一个的话。
$sql = "select field1 from pre_common_member_profile where uid='$username'";
$query = mysql_query($sql);
$bianliang = mysql_result($query,0);
echo $bianliang;
取数组的话。
$sql = "select field1 from pre_common_member_profile where uid='$username'";
$query = mysql_query($sql);
while($row = mysql_fetch_array($query))
{
echo $row["field1 "];
}
完毕。这些操作sql的基础知识,去看看php100的视频教程吧。给分。
$sql = "select field1 from pre_common_member_profile where uid='$username'";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)){
$number = $row[0]; //按照索引来获取值;然后进行变量的赋值;
}
将"while($row = mysql_fetch_array($result)){" 改为 $row = mysql_fetch_array($result);
因为循环结束时$row的结果会为空.
mysql_query()
mysql_fetch_array