我写了个php读数据库内容  
         $link=mysql_connect('localhost',$us,$ps); //这两个变量是从html传过来的,没问题
         $bIsok = mysql_select_db("sq_newoa");
   最开始的时候连接上了,数据读出来显示了,就是后面跟个内存不能读的错误,运行两次之后干脆什麽东西后没了,就是这个错误提示,
      下面是我最开始配置和后来调整的过程
1.加载模块 extension=php_mysql.dll
  路径变量添加了php的设置:“;D:\php;D:\php\ext”,去掉了MySQL在路径中的设置
  最后phpinfo显示如下这应该是已经连上数据库的意思了吧,我觉得不是配置的问题,不知大家什么看法,我设置的时候就是按照网上介绍方法来的,没仔细了解过具体配置;
加一句,我用phpmyadmin处理数据库没有任何问题;就是自己编php的时候出内存不能读的问题;
4.下面几个方法都试过,都不能搞掉这个问题:
   把 libmySQL.dll 、php_mysql.dll 拷贝到system32文件夹;
   运行 cmd ,运行语句 for %1 in(%windir%\system32\*.dll) do regsvr32.exe/s %1
   运行 regedit ,修改里边的键,具体哪个不记得了大家帮帮忙,我qq 1002135144,初入门,分数不多,谢谢啦

解决方案 »

  1.   

    第一二遍运行的时候,会把我要求的数据输出来,然后报内存不能读的错误,之后就再也连不上了,下面是错误提示:输入错误密码时回报错,我觉着只是对的
    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in D:\apache\htdocs\try_search.php on line 8
    数据库连接失败!但输入正确密码的也运行不下去了,错误如下:Notice: Undefined variable: us in D:\apache\htdocs\try_search.php on line 6
    Notice: Undefined variable: us in D:\apache\htdocs\try_search.php on line 8
    Notice: Undefined variable: ps in D:\apache\htdocs\try_search.php on line 8
    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 
    'SYSTEM'@'localhost' (using password: NO) in D:\apache\htdocs\try_search.php on line 8
    数据库连接失败!
      

  2.   

    如果怀疑是MYSQL的问题,就去看一下MYSQL的错误日志中的信息,看看有什么线索。你每次PHP中结果有没有 mysql_free_result ,mysql_close ?
      

  3.   

    但输入正确密码的也运行不下去了,错误如下: Notice: Undefined variable: us in D:\apache\htdocs\try_search.php on line 6 
    Notice: Undefined variable: us in D:\apache\htdocs\try_search.php on line 8 
    Notice: Undefined variable: ps in D:\apache\htdocs\try_search.php on line 8 
    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 
    'SYSTEM'@'localhost' (using password: NO) in D:\apache\htdocs\try_search.php on line 8 
    数据库连接失败! 您没有定义变量us ps 使用没有密码的账号'SYSTEM'@'localhost'登陆也失败!
    您直接这样测试,看是否有问题!$us="user";
    $ps="password";
    $link=mysql_connect('localhost',$us,$ps); //这两个变量是从html传过来的,没问题 
    $bIsok = mysql_select_db("sq_newoa"); 
      

  4.   


    我不知道错误日志在哪里可以查询到,data文件夹下没有<hostname>.err,倒是有WWW-F4035126DEA.err,
    不过不是很明白,下面这些是错误吗?
    091125 10:48:33 [Note] Plugin 'FEDERATED' is disabled.
    091125 10:48:46  InnoDB: Started; log sequence number 0 44243
    091125 10:48:54 [Note] Event Scheduler: Loaded 0 events
    091125 10:48:54 [Note] D:\MySQL\bin\mysqld: ready for connections.
    Version: '5.1.39-community'  socket: ''  port: 3306  MySQL Community Server (GPL)是不是应该先在my.cnf里用--log-error["文件名"]设置错误日志生成?
    我这儿只有my.ini,这个好像不是设置文件,连用户名密码都没有。
    加一句我的MySQL版本是mysql-5.1.39-win32,能不能指导一下