phonegap应用程序到mysql服务器的数据库连接

时间:2014-03-05 07:30:21

标签: php mysql

我刚刚使用jquery和ajax完成了我的移动应用程序,它在我的网络浏览器上完美运行,但是当我使用手机间隙进行编译时。但是,数据库连接不起作用。

我创建了一个helper类,它包含数据库连接的所有php代码。当我运行我的应用时,正在查看整个查询而不是结果。

请帮忙。

我的助手类有以下代码:

class helper
{
  private $con;
  function __construct()
  {
    $this->con= new mysqli("192.168.1.22","root","","rmoce");
  }
  function __destruct()
  {
    $this->con->close();
  }
  function insert($table,$field,$value)
  {
    $str=" insert into $table($field) values($value) ";
    $this->con->query($str) or die($this->con->error);
  }
  function delete($table,$condition)
  {
    $str= "delete from $table where $condition";
    $this->con->query($str);
  }
  function update($str)
  {
    $this->con->query($str);
  }
  function select($field,$table,$condition)
  {
    $str="select $field from $table where $condition";
$result= $this->con->query($str) or die($this->con->error);
if ($result->num_rows==0)
{
  return "no";
}
else
{
  while($row = $result->fetch_array(MYSQL_ASSOC))
{
  $data[] = $row;
}
return $data;
  }
}

$obj= new helper();

当我运行应用程序时,我会看到整个查询本身。请帮忙。

0 个答案:

没有答案
相关问题