PHP files
Config file
<?php
define('DB_USER', "root");
define('DB_PASSWORD', "");
define('DB_DATABASE', "elec_bill");
define('DB_SERVER', "localhost");
?>
Connection class file
<?php
class DB_CONNECT {
function __construct() {
$this->connect();
}
function __destruct() {
$this->close();
}
function connect() {
require_once __DIR__ . '/db_config.php';
$con = mysql_connect(DB_SERVER, DB_USER, DB_PASSWORD) or die(mysql_error());
$db = mysql_select_db(DB_DATABASE) or die(mysql_error()) or die(mysql_error());
return $con;
}
function close() {
mysql_close();
}
}
?>
bridging file
<?php
$response = array();
if(isset($_POST['user_id'])&&($_POST['connect']=="connectionallowed")){
require_once __DIR__ . '/db_connect.php';
$assignto=$_POST['user_id'];
$db = new DB_CONNECT();
$result = mysql_query("SELECT * FROM ebill_details WHERE eb_mtr_sl_no='$assignto'") or die(mysql_error());
if (mysql_num_rows($result) > 0) {
$response["consumers"] = array();
while ($row = mysql_fetch_array($result)) {
$customerlist = array();
$customerlist["cons_ac_no"] = $row["eb_cons_ac_no"];
$customerlist["cust_id"]=$row["eb_cust_id"];
$customerlist["oa_no"]=$row["eb_oa_no"];
$customerlist["inst_no"]=$row["eb_inst_no"];
$customerlist["mtr_sl_no"]=$row["eb_mtr_sl_no"];
$customerlist["mtr_owner"]=$row["eb_mtr_owner"];
$customerlist["cons_name"]=$row["eb_cons_name"];
$customerlist["cons_addrs"]=$row["eb_cons_addrs"];
$customerlist["bill_unit_1"]=$row["eb_bill_unit_1"];
$customerlist["prev_unit"]=$row["eb_prev_unit"];
$customerlist["prev_amt"]=$row["eb_prev_amt"];
$customerlist["pre_mtr_rdng"]=$row["eb_pre_mtr_rdng"];
$customerlist["tax"]=$row["eb_tax"];
$customerlist["bill_unit_2"]=$row["eb_bill_unit_2"];
$customerlist["bill_unit_3"]=$row["eb_bill_unit_3"];
$customerlist["bill_basis"]=$row["eb_bill_basis"];
$customerlist["energy_charge"]=$row["eb_energy_charge"];
$customerlist["ed_charge"]=$row["eb_ed_charge"];
$customerlist["mtr_rent"]=$row["eb_mtr_rent"];
$customerlist["misc_charge"]=$row["eb_misc_charge"];
$customerlist["prev_bill_dt"]=$row["eb_prev_bill_dt"];
array_push($response["consumers"], $customerlist);
}
$response["success"] = 1;
echo json_encode($response);
} else {
$response["success"] = 0;
$response["message"] = "No user found";
echo json_encode($response);
}
}else {
$response["success"] = 0;
$response["message"] = "Required field missing";
echo json_encode($response);
}
?>
Config file
<?php
define('DB_USER', "root");
define('DB_PASSWORD', "");
define('DB_DATABASE', "elec_bill");
define('DB_SERVER', "localhost");
?>
Connection class file
<?php
class DB_CONNECT {
function __construct() {
$this->connect();
}
function __destruct() {
$this->close();
}
function connect() {
require_once __DIR__ . '/db_config.php';
$con = mysql_connect(DB_SERVER, DB_USER, DB_PASSWORD) or die(mysql_error());
$db = mysql_select_db(DB_DATABASE) or die(mysql_error()) or die(mysql_error());
return $con;
}
function close() {
mysql_close();
}
}
?>
bridging file
<?php
$response = array();
if(isset($_POST['user_id'])&&($_POST['connect']=="connectionallowed")){
require_once __DIR__ . '/db_connect.php';
$assignto=$_POST['user_id'];
$db = new DB_CONNECT();
$result = mysql_query("SELECT * FROM ebill_details WHERE eb_mtr_sl_no='$assignto'") or die(mysql_error());
if (mysql_num_rows($result) > 0) {
$response["consumers"] = array();
while ($row = mysql_fetch_array($result)) {
$customerlist = array();
$customerlist["cons_ac_no"] = $row["eb_cons_ac_no"];
$customerlist["cust_id"]=$row["eb_cust_id"];
$customerlist["oa_no"]=$row["eb_oa_no"];
$customerlist["inst_no"]=$row["eb_inst_no"];
$customerlist["mtr_sl_no"]=$row["eb_mtr_sl_no"];
$customerlist["mtr_owner"]=$row["eb_mtr_owner"];
$customerlist["cons_name"]=$row["eb_cons_name"];
$customerlist["cons_addrs"]=$row["eb_cons_addrs"];
$customerlist["bill_unit_1"]=$row["eb_bill_unit_1"];
$customerlist["prev_unit"]=$row["eb_prev_unit"];
$customerlist["prev_amt"]=$row["eb_prev_amt"];
$customerlist["pre_mtr_rdng"]=$row["eb_pre_mtr_rdng"];
$customerlist["tax"]=$row["eb_tax"];
$customerlist["bill_unit_2"]=$row["eb_bill_unit_2"];
$customerlist["bill_unit_3"]=$row["eb_bill_unit_3"];
$customerlist["bill_basis"]=$row["eb_bill_basis"];
$customerlist["energy_charge"]=$row["eb_energy_charge"];
$customerlist["ed_charge"]=$row["eb_ed_charge"];
$customerlist["mtr_rent"]=$row["eb_mtr_rent"];
$customerlist["misc_charge"]=$row["eb_misc_charge"];
$customerlist["prev_bill_dt"]=$row["eb_prev_bill_dt"];
array_push($response["consumers"], $customerlist);
}
$response["success"] = 1;
echo json_encode($response);
} else {
$response["success"] = 0;
$response["message"] = "No user found";
echo json_encode($response);
}
}else {
$response["success"] = 0;
$response["message"] = "Required field missing";
echo json_encode($response);
}
?>
We are a bunch of volunteers and opening a brand new scheme in
ReplyDeleteour community. Your website provided us with helpful info to work on.
You've done an impressive task and our whole neighborhood can be
grateful to you.
Feel free to visit my homepage: search engine optimization
I do consider all the ideas you've introduced in your post.
ReplyDeleteThey are very convincing and can certainly work. Still, the posts are too quick for newbies.
May just you please prolong them a bit from subsequent time?
Thanks for the post.
Here is my website; waist hip ratio calculator
You actually make it appear so easy along with your presentation
ReplyDeletehowever I to find this matter to be actually something that I think I would by no means understand.
It kind of feels too complex and very huge for me.
I am looking forward to your next submit, I will try to get the cling of it!
Look at my page :: seo Google
Howdy great blog! Does running a blog like this
ReplyDeleterequire a large amount of work? I have no understanding of coding but I had been hoping to start my own blog in the near future.
Anyway, if you have any suggestions or tips for new blog owners please share.
I understand this is off subject nevertheless I just had
to ask. Kudos!
my blog: search engine optimization (http://123abcdef123456.com)
I visited multiple web pages but the audio feature for audio songs existing at this website is in fact
ReplyDeletemarvelous.
Here is my webpage :: http://www.melbournebusinesscoach.net/melbourne-team-building/ - tryminecraftfreeonline.com,
great put up, very informative. I ponder why the opposite
ReplyDeleteexperts of this sector don't notice this. You should proceed your
writing. I'm confident, you've a great readers' base already!
Also visit my blog post ... seo rankings ()
Hi, i think that i saw you visited my site so i came to “return the favor”.I am trying to find things to improve my web
ReplyDeletesite!I suppose its ok to use a few of your ideas!!
Also visit my web page :: calculate bmi
There is definately a great deal to find out about this subject.
ReplyDeleteI like all the points you've made.
My web blog - www.freshwaterplumbingmelbourne.com []
Howdy, I think your web site could be having internet browser compatibility issues.
ReplyDeleteWhenever I take a look at your web site in Safari,
it looks fine but when opening in IE, it's got some overlapping issues.
I simply wanted to provide you with a quick heads up!
Apart from that, wonderful website!
My weblog 1 ()
I've read a few good stuff here. Definitely price bookmarking for revisiting.
ReplyDeleteI wonder how so much attempt you set to create the sort of
wonderful informative site.
Also visit my blog post; search engine optimization