php codefunction writeleft(){ $retarray = array(); [color=#ff0000]$sql = select id,name,strr from jh_lanmu;[/color] $result = mysql_query($sql,$conn); while($myrow = mysql_fetch_array($result,mysql_both)) { $retarray[] = $myrow; } mysql_free_result($result); foreach($retarray as $tmp) { echo '
'.$tmp[0].''.chr(13); }}
红色的sql语句在navicat中查询是没有报错的,能够查出结果,但是php页面上始终报错:
mysql_query(): supplied argument is not a valid mysql-link resource in f:\phpwebsite\jinghong\config.php on line 11
其他的sql操作都能正常运行。
数据库代码如下:
drop table if exists `jh_lanmu`;
create table `jh_lanmu` (
`id` int(11) not null auto_increment,
`name` varchar(20) default null,
`strr` varchar(50) default null,
primary key (`id`)
) engine=innodb auto_increment=3 default charset=gbk;
-- ----------------------------
-- records of jh_lanmu
-- ----------------------------
insert into `jh_lanmu` values ('1', '产品配料', 'cppl.php');
insert into `jh_lanmu` values ('2', '产品系列', 'cpxl.php');
------解决方案--------------------
function writeleft()
{
global $conn;
