<?php
session_start();
class add
{
var $conn;
function __construct()
{
$this->conn=new MySQLi("localhost","root","","bis_tally");
}
//-----------------------------------
function addStudent($user_name,$user_pass,$user_email,$user_contact)
{
$addUser=$this->conn->prepare("INSERT INTO `user`(user_name,user_pass,user_email,user_contact)VALUES(?,?,?,?);");
$addUser->bind_param("ssss",$user_name,$user_pass,$user_email,$user_contact);
$addUser->execute();
//--------------error
header("location:index.php");
echo "you are registred" ;
//-----------------
}
function addBuyer($company_address,
$buyer_name,
$invoice_number,
$date,$delivery_note,
$terms_of_payment,
$supplier_reference,
$other_reference,
$buyer_order_number,
$date_1,
$despatch_doc_number,
$date_2,
$despatched_through,
$destination,
$terms_of_delivery,
$particular,
$quantity,
$rate,
$percentile,
$amount,
$service_tax)
{
$addInfo=$this->conn->prepare("INSERT INTO `buyer`(company_address,buyer_name,invoice_number,
date,delivery_note,terms_of_payment,supplier_reference,other_reference,buyer_order_number,date_1,despatch_doc_number,date_2,
despatched_through,destination,terms_of_delivery,particular,quantity,rate,percentile,amount,service_tax)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);");
$addInfo->bind_param("ssisssssssssssssiiiis",$company_address,$buyer_name,$invoice_number,
$date,$delivery_note,$terms_of_payment,$supplier_reference,$other_reference,$buyer_order_number,
$date_1,$despatch_doc_number,$date_2,$despatched_through,$destination,$terms_of_delivery,$particular,$quantity,
$rate,$percentile,$amount,$service_tax);
$addInfo->execute();
}//-------------------------new function for amount --------------------
function addAmount($invoice_number,$quantity,$rate,$percentile,$amount)
{
$addValue=$this->conn->prepare("INSERT INTO `amount2`(invoice_number,quantity,rate,percentile,amount) VALUES (?,?,?,?,?);");
$addValue->bind_param("iiiii",$invoice_number,$quantity,$rate,$percentile,$amount);
$addValue->execute();
}
//--------------------------------------------------------------------
function login($user_name,$user_pass)
{
$login=$this->conn->prepare("SELECT * FROM `user` WHERE `user_name`='".$user_name."' AND `user_pass`='".$user_pass."'");
$login->bind_param("ss",$user_name,$user_pass);
$login->execute();
$login->store_result();
if($login->num_rows == 0)
{
return false;
}
else
{
return true;
}
}
// next function..... contd...
}
?>
very important concept of SSSSS.....
contd....
session_start();
class add
{
var $conn;
function __construct()
{
$this->conn=new MySQLi("localhost","root","","bis_tally");
}
//-----------------------------------
function addStudent($user_name,$user_pass,$user_email,$user_contact)
{
$addUser=$this->conn->prepare("INSERT INTO `user`(user_name,user_pass,user_email,user_contact)VALUES(?,?,?,?);");
$addUser->bind_param("ssss",$user_name,$user_pass,$user_email,$user_contact);
$addUser->execute();
//--------------error
header("location:index.php");
echo "you are registred" ;
//-----------------
}
function addBuyer($company_address,
$buyer_name,
$invoice_number,
$date,$delivery_note,
$terms_of_payment,
$supplier_reference,
$other_reference,
$buyer_order_number,
$date_1,
$despatch_doc_number,
$date_2,
$despatched_through,
$destination,
$terms_of_delivery,
$particular,
$quantity,
$rate,
$percentile,
$amount,
$service_tax)
{
$addInfo=$this->conn->prepare("INSERT INTO `buyer`(company_address,buyer_name,invoice_number,
date,delivery_note,terms_of_payment,supplier_reference,other_reference,buyer_order_number,date_1,despatch_doc_number,date_2,
despatched_through,destination,terms_of_delivery,particular,quantity,rate,percentile,amount,service_tax)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);");
$addInfo->bind_param("ssisssssssssssssiiiis",$company_address,$buyer_name,$invoice_number,
$date,$delivery_note,$terms_of_payment,$supplier_reference,$other_reference,$buyer_order_number,
$date_1,$despatch_doc_number,$date_2,$despatched_through,$destination,$terms_of_delivery,$particular,$quantity,
$rate,$percentile,$amount,$service_tax);
$addInfo->execute();
}//-------------------------new function for amount --------------------
function addAmount($invoice_number,$quantity,$rate,$percentile,$amount)
{
$addValue=$this->conn->prepare("INSERT INTO `amount2`(invoice_number,quantity,rate,percentile,amount) VALUES (?,?,?,?,?);");
$addValue->bind_param("iiiii",$invoice_number,$quantity,$rate,$percentile,$amount);
$addValue->execute();
}
//--------------------------------------------------------------------
function login($user_name,$user_pass)
{
$login=$this->conn->prepare("SELECT * FROM `user` WHERE `user_name`='".$user_name."' AND `user_pass`='".$user_pass."'");
$login->bind_param("ss",$user_name,$user_pass);
$login->execute();
$login->store_result();
if($login->num_rows == 0)
{
return false;
}
else
{
return true;
}
}
// next function..... contd...
}
?>
very important concept of SSSSS.....
contd....
No comments:
Post a Comment