请问一个PHP操作MYSQL的有关问题
Release: 2016-06-13 10:45:26
Original
766 people have browsed it
请教一个PHP操作MYSQL的问题
PHP code<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->function 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 '
Copy after login
'.$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;
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31