4 Replies Latest reply: Aug 20, 2013 5:53 PM by cj RSS

    jQuery EasyUI - oracle connection

    36ac619a-e69b-49ad-9e8d-e61957126894

      Hello,

      Can someone help me with this problem please.

      How can I modify the below code to connect Oracle localhost database?

       

       

       

      Thanks,

      Kenned

       

       

      connect.php

      <?php

       

       

      $conn = @mysql_connect('127.0.0.1','root','root');

      if (!$conn) {

        die('Could not connect: ' . mysql_error());

      }

      mysql_select_db('mydb', $conn);

       

       

      ?>

       

       

       

       

      get_data.php

      <?php

        $page = isset($_POST['page']) ? intval($_POST['page']) : 1;

        $rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10;

        $offset = ($page-1)*$rows;

        $result = array();

       

       

        include 'conn.php';

       

        $rs = mysql_query("select count(*) from users");

        $row = mysql_fetch_row($rs);

        $result["total"] = $row[0];

        $rs = mysql_query("select * from users limit $offset,$rows");

       

        $items = array();

        while($row = mysql_fetch_object($rs)){

        array_push($items, $row);

        }

        $result["rows"] = $items;

       

       

        echo json_encode($result);

       

       

      ?>

       

       

      index.php

      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

      <html>

      <head>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

        <meta name="keywords" content="jquery,ui,easy,easyui,web">

        <meta name="description" content="easyui help you build your web page easily!">

        <title>jQuery EasyUI Demo</title>

        <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">

        <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css">

        <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/demo/demo.css">

        <style type="text/css">

        #fm{

        margin:0;

        padding:10px 30px;

        }

        .ftitle{

        font-size:14px;

        font-weight:bold;

        color:#666;

        padding:5px 0;

        margin-bottom:10px;

        border-bottom:1px solid #ccc;

        }

        .fitem{

        margin-bottom:5px;

        }

        .fitem label{

        display:inline-block;

        width:80px;

        }

        </style>

        <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.min.js"></script>

        <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>

       

      </head>

      <body>

        <h2>jQuery EasyUI Demo</h2>

       

        <table id="dg" title="My Users" class="easyui-datagrid" style="width:700px;height:250px"

        url="get_users.php"

        toolbar="#toolbar" pagination="true"

        rownumbers="true" fitColumns="true" singleSelect="true">

        <thead>

        <tr>

        <th field="firstname" width="50">First Name</th>

        <th field="lastname" width="50">Last Name</th>

        <th field="phone" width="50">Phone</th>

        <th field="email" width="50">Email</th>

        </tr>

        </thead>

        </table>

       

       

      </body>

      </html>