PHPcodefunctionwriteLeft () {$ retArray = array (); [color = # FF0000] $ SQL = & quot; selectid, name, strrfromjh_lanmu & quot
PHP code
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 '
'.$tmp[0].''.chr(13); }}
There is no error in the query of the red SQL statement in Navicat. The result can be found, but the PHP page always reports an error:
Mysql_query (): supplied argument is not a valid MySQL-Link resource in F: \ PHPWebSite \ jinghong \ config. php on line 11
Other SQL operations can run normally.
The database code is as follows:
Drop table if exists 'Your _ lanmu ';
Create table 'Your _ 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 'values _ lanmu 'VALUES ('1', 'product batching', 'cppl. php ');
Insert into 'values _ lanmu 'VALUES ('2', 'product series', 'cpxl. php ');
------ Solution --------------------
Function writeLeft ()
{
Global $ conn;