第二.
$sql="select class.class,Nclass.Nclass,download.showname,download.bb,download.classid,download.Nclassid,download.lasthits from download,class,Nclass where download.classid=class.classid and download.Nclassid=Nclass.Nclassid and download.ID=".$id;
$sql="select class.class,Nclass.Nclass,download.showname,download.bb,download.classid,download.Nclassid,download.lasthits from download,class,Nclass where download.classid=class.classid and download.Nclassid=Nclass.Nclassid and download.ID=".$id;
怎么在sql语句中使用变量
比如
$sql_Nclass="SELECT * FROM nclass where 281=nclass.Nclassid";
运行没有问题
而
$id=281;
$sql_Nclass="SELECT * FROM nclass where "$id"=nclass.Nclassid";
却不对,那该怎么用变量呀
$sql="select class.class,Nclass.Nclass,download.showname,download.bb,download.classid,download.Nclassid,download.lasthits from class,Nclass,download where download.classid=class.classid and download.Nclassid=Nclass.Nclassid and download.ID=".$id;
$result=mysql_query($sql,$connect);//运行这句有错
错误为:Warning: Supplied argument is not a valid MySQL-Link resource
怎么解决
你可以这样自己调一下.
print $sql;
看看他打印出的语句是否有错的.
或把他放到myadmin中运行看出不出错.
$sql_Nclass="SELECT * FROM nclass where "$id"=nclass.Nclassid";
改为:
$sql_Nclass="SELECT * FROM nclass where ".$id."=nclass.Nclassid";
这个问题比较困惑
理论上应该是得到服务器得headers吧?可以用socket函数来实现,然后用正则表达式提取用fopen打开http连接也可以
--------------------------------------------------------------------------------
函式:getallheaders()
--------------------------------------------------------------------------------
阿帕契伺服器专用函式库
getallheaders
获得所有 HTTP 变数值。语法: array getallheaders(void);传回值: 阵列函式种类: PHP 系统功能
内容说明
使用本项功能时不需代入任何参数值,传回的是所有 HTTP 变数值,并使用组合的阵列传回。
使用范例
下例列出所有的 HTTP 变数<?php
$headers = getallheaders();
while (list($header, $value) = each($headers)) {
echo "$header: $value<br>\n";
}
?>
备注: 这个函式只有 PHP 以阿帕契伺服器的模组 (module) 方式执行时方有效。