使用了  zf框架

解决方案 »

  1.   

    js、ajax是不能连接mysql数据库的,应该是js通过PHP返回结果
      

  2.   

    为啥有得人士说  是通过ajax返回的呢?
      

  3.   

    http://www.w3school.com.cn/php/php_ajax_database.asp
      

  4.   

    PHP代码:$link = mysql_connect('localhost','root','123456');
    mysql_select_db('test',$link);
    mysql_query('set names utf8',$link);
    $result = mysql_query('select row from test limit 1',$link);
    if(($row=mysql_fetch_array($result))!==false){
      echo $row;
    }else{
      echo "no data";
    }JQuery代码$.ajax({
    url: 'test.php',
    cache: false,
    type: 'GET',
    success: function(html){
    alert(html)
    }
    });Mootools代码new Request({
    url: 'test.php',
    method: 'GET',
    success: function(html){
    alert(html)
    }
    });