$answer=mysql_fetch_array($result);
echo $answer[x],x为数组下标。或
$answer=mysql_fetch_object($result);
echo $qnswer->xxx,xxx为字段名。
echo $answer[x],x为数组下标。或
$answer=mysql_fetch_object($result);
echo $qnswer->xxx,xxx为字段名。
需要使用 mysql_fetch_array 或是 mysql_fetch_object 把结果取出来.
$array = mysql_fetch_array($result);
echo $array[$i];
//$i = 0,读出符合条件的一条记录的第一个关键字,$i = 1,读出第一条记录的第二个关键字,类推
$num = mysql_num_rows($query);
$array = mysql_fetch_array($query);
for ($i = 0;$i < $num;$i ++){
echo "<a href=\"".$array[key1]."\">".$array[key2]."</a></br>";
}
$num = mysql_num_rows($query);
$array = mysql_fetch_array($query);
for ($i = 0;$i < $num;$i ++){
echo "<a href=\"".$array[key1]."\">".$array[key2]."</a></br>";
}
<?
{
$conn=mysql_connect("mysql.huaheng.cc","web29658","f3i6r2b5");
mysql_select_db("db_huaheng_cc");
$sql="select * from download_user where name= '".$HTTP_POST_VARS["username"]."'";
$result=mysql_query($sql,$conn);
$num = mysql_num_rows($result);
$answer=mysql_fetch_array($result);
?></td>
<td width="91%" background="../images/title-bg.jpg" class="font12pt" valign="top">
<div align="center"><font class="font12pt">保密性软件下载</font></div>
</td>
</tr>
</table>
<p> </p>
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><? for ($i = 0;$i < $num;$i ++){
echo " [<a href=$answer[4]> ".($answer[3])." </a>]"; }?>
$num = mysql_num_rows($query);
for ($i = 0;$i < $num;$i++){
$array = mysql_fetch_object($query);
echo "<a href=\"".$array->key1."\">".$array->key2."</a></br>";
}
echo $result[$i][$j];$i指第几条记录,$j指这个记录的第几个字段。
while($data=mysql_fetch_array($query)) //将结果按数组顺序取出,直至返回0为止
{
echo "正在向$data[email]发送邮件……<br>";
mail($data[email],"Bluenow邮件列表",$text,"From: [email protected]\nReply-To: [email protected]");
}
echo "发送成功!$msg";
我的代码是这样的:
<?
{
$conn=mysql_connect("mysql.huaheng.cc","web29658","f3i6r2b5");
mysql_select_db("db_huaheng_cc");
$sql="select * from download_user where name= '".$HTTP_POST_VARS["username"]."'";
$result=mysql_query($sql,$conn);
$num = mysql_num_rows($result);
?></td>
<td width="91%" background="../images/title-bg.jpg" class="font12pt" valign="top">
<div align="center"><font class="font12pt">保密性软件下载</font></div>
</td>
</tr>
</table>
<p> </p>
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><? for ($i = 0;$i < $num;$i ++){
$answer=mysql_fetch_array($result);
echo "[<a href="$answer[4];">".($answer[3])."</a>]"; }?>
$array = mysql_fetch_object($query);
echo "<a href=\"".$array->key4."\">".$array->key3."</a></br>";
}
其中key*是你的具体关键字,
还有这句
$sql="select * from download_user where name= '".$HTTP_POST_VARS["username"]."'";
可以用session一个username,直接where name=$username;
不要随便把你的mysqlconnect贴出来!
我的代码是这样写的echo "<a href=..\download_secrecy\"".$answer->filelink."\">".$answer->filename."</a>
echo "<a href=..\download_secrecy\\".$answer->filelink.">".$answer->filename."</a>
<?
echo "<a href=../download_secrecy/".$answer-filelink."/">".$answer->filename."</a>";
?>