Monday, 21 November 2016

Using an Access Database with PHP

(1)First download    extension=php_pdo_odbc.dll     
(2)then copy it and paste inside your xampp path: "C:\xampp\php"
(3)now open your php.ini  file   open it from  path: "C:\xampp\php" and

remove   ;   from  extension=php_pdo_odbc.dll  

(4)after removing  ; you will get
(5) now create a  folder   "ms "  inside your   C:\xampp\htdocs\  and keep your   msaccess file products.mdb    database file  and create a table  product with two columns (pid ,pname )
now your path for database file  will be   "C:\xampp\htdocs\ms\products.mdb"

(6)now write code for   select .php file :

<?php
$dbName = $_SERVER["DOCUMENT_ROOT"] . "/ms/products.mdb";

echo  $_SERVER["DOCUMENT_ROOT"];
if (!file_exists($dbName)) {
    die("Could not find database file.");
}
$db = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$dbName; Uid=; Pwd=;");

$sql  = "SELECT * FROM product";
$result = $db->query($sql);
while ($row = $result->fetch())
{
    echo $row["pid"];
    echo $row["pname"];
 
}


?>

(2)how to insert form data to msaccess database table:

create a  folder   "ms "  inside your   C:\xampp\htdocs\  and keep your   msaccess file products.mdb    database file  and create a table  product with two columns (pid ,pname )
now your path for database file  will be   "C:\xampp\htdocs\ms\products.mdb"

(1)write code for insert.html file:

<form action="insert.php"  method="post">
pid<input type=text name=pid>
pname<input type=text name=pname>
<input type=submit name=submit value=submit>
</form>
(2)now write code for  insert.php file:

<?php
$dbName = $_SERVER["DOCUMENT_ROOT"] . "/ms/products.mdb";

echo  $_SERVER["DOCUMENT_ROOT"];
if (!file_exists($dbName)) {
    die("Could not find database file.");
}
$con = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$dbName; Uid=; Pwd=;");


$sql = "insert into product(pid,pname) values(:pid,:pname)";
$statement = $con->prepare($sql);
$statement->bindParam(':pid', $_POST['pid'], PDO::PARAM_INT);
$statement->bindParam(':pname', $_POST['pname'], PDO::PARAM_STR);

$result = $statement->execute();
if($result)
 echo "Inserted Successfully!";
else
 echo "Not Inserted";



?>


(3)NOW WRITE CODE FOR UPDATEING TABLE RECORD:

(1)write code for update.html file:

<form action="update.php"  method="post">
pid<input type=text name=pid>
pname<input type=text name=pname>
<input type=submit name=submit value=submit>
</form>

(2)now write code for update.php file:

<?php
$dbName = $_SERVER["DOCUMENT_ROOT"] . "/ms/products.mdb";

echo  $_SERVER["DOCUMENT_ROOT"];
if (!file_exists($dbName)) {
    die("Could not find database file.");
}
$con = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$dbName; Uid=; Pwd=;");


$sql = "UPDATE product SET pname=:pname where pid=:pid";
$statement = $con->prepare($sql);
$statement->bindParam(':pid', $_POST['pid'], PDO::PARAM_INT);
$statement->bindParam(':pname', $_POST['pname'], PDO::PARAM_STR);

$result = $statement->execute();
if($result)
 echo "UPDATED Successfully!";
else
 echo "Not updated";

?>

(4)NOW WRITE CODE FOR DELETING RECORD FROM  TABLE OF MSACCESS:

(1)write code for  delete.html file:

<form action="delete.php"  method="post">
pid<input type=text name=pid>

<input type=submit name=submit value=submit>
</form>

(2)write code for delete.php file:

<?php
$dbName = $_SERVER["DOCUMENT_ROOT"] . "/ms/products.mdb";

echo  $_SERVER["DOCUMENT_ROOT"];
if (!file_exists($dbName)) {
    die("Could not find database file.");
}
$con = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$dbName; Uid=; Pwd=;");


$sql = "delete from product  where pid=:pid";
$statement = $con->prepare($sql);
$statement->bindParam(':pid', $_POST['pid'], PDO::PARAM_INT);

$result = $statement->execute();
if($result)
 echo "deleted Successfully!";
else
 echo "Not deleted";

?>

Saturday, 5 November 2016

how to create procedure in XAMPP-MYSQL and how to insert form data to database using Procedure

(1)FIRST CREATE TABLE   tbl_ext:

SQL>
create table tbl_ext
(id  int primary key auto_increment,
name  varchar(200),
address  varchar(200)
);

======================================================================
INSERT   RECORD INTO DATABASE USING MYSQL PROCEDURE IN PHP:
======================================================================

(2)CREATE PROCEDURE  myinsert():

SQL>

CREATE PROCEDURE  myinsert(IN name varchar(20),IN adds varchar(200))

BEGIN INSERT INTO tbl_ext(name ,address)VALUES(name,adds);

End



(3)CALL PROCEDURE:

SQL>call  myinsert('OMji','VIRAR');

(4)WRITE  CODE  FOR   "insert.html"  file:

<form  action="insert.php"  method="post">
name<input type=text     name=name>
address<input type=text  name=address>
<input type=submit name=submit value="submit">
</form>


(5)WRITE CODE FOR  "insert.php"  file:

<?php
$con=mysql_connect("Localhost","root","");
mysql_select_db('abhi',$con);
$name=$_POST['name'];
$city=$_POST['address'];
$sql="call  myinsert('$name','$city')";
$result=mysql_query($sql);
if($result)
{
echo "record inserted";

}
else

{

echo "record not inserted";

}

?>



======================================================================
DISPLAY  DATABASE RECORD USING MYSQL PROCEDURE IN PHP:
======================================================================
(1)FIRST CREATE  PROCEDURE mydisplay():

SQL>CREATE PROCEDURE mydisplay()

BEGIN

select * from tbl_ext;

End

(2)WRITE CODE FOR  display.php file:

<?php
$con=mysql_connect("Localhost","root","");
mysql_select_db('abhi',$con);
$sql="call mydisplay()";
$result=mysql_query($sql);
while($row=mysql_fetch_array($result))
{

echo $row['id'];
echo $row['name'];
echo $row['address'];
}
?>


======================================================================
UPDATE  DATABASE RECORD USING MYSQL PROCEDURE IN PHP:
======================================================================

(1)CREATE PROCEDURE  myupdate():

SQL>CREATE PROCEDURE myupdate(IN myid varchar(20),IN myname varchar(20),IN myaddress varchar(20))
BEGIN
update tbl_ext  set name=myname,address=myaddress where id=myid;
End

(2)NOW WRITE CODE FOR  update.html :

<form  action="update.php"  method="post">
id<input type=text name=id>
name<input type=text     name=name>
address<input type=text  name=address>
<input type=submit name=submit value="submit">
</form>

(3)NOW WRITE CODE FOR update.php  file:

<?php
$con=mysql_connect("Localhost","root","");
mysql_select_db('abhi',$con);
$id=$_POST['id'];
$name=$_POST['name'];
$city=$_POST['address'];
$sql="call myupdate('$id','$name','$city')";
$result=mysql_query($sql);
if($result)
{
echo "record updated";
}
else
{
echo "record not updated";
}
?>

======================================================================
DELETE   DATABASE RECORD USING MYSQL PROCEDURE IN PHP:
======================================================================
(1)FIRST CREATE PROCEDURE   mydelete():

CREATE PROCEDURE mydelete(IN myid varchar(20))
BEGIN
delete from tbl_ext  where id=myid;
End

(2)WRITE CODE FOR  delete.html  file:

<form  action="delete.php"  method="post">
id<input type=text name=id>
<input type=submit name=submit value="submit">
</form>

(3)NOW WRITE CODE FOR delete.php file:

<?php
$con=mysql_connect("Localhost","root","");
mysql_select_db('abhi',$con);
$id=$_POST['id'];

$sql="call mydelete('$id')";
$result=mysql_query($sql);
if($result)
{
echo "record deleted";
}
else
{
echo "record not deleted";
}
?>







Thursday, 3 November 2016

how to create desktop application using php

Phalanger : 


Phalanger is a project which was started at Charles University in Prague and was supported by Microsoft. It compiles source code written in the PHP scripting language into CIL (Common Intermediate Language) byte-code. It handles the beginning of a compiling process which is completed by the JIT compiler component of the .NET Framework. It does not address native code generation nor optimization. Its purpose is to compile PHP scripts into .NET assemblies, logical units containing CIL code and meta-data.
Bambalam :
Bambalam PHP EXE Compiler/Embedder is a free command line tool to convert PHP applications to standalone Windows .exe applications. The exe files produced are totally standalone, no need for php dlls etc. The php code is encoded using the Turck MMCache Encode library so it's a perfect solution if you want to distribute your application while protecting your source code. The converter is also suitable for producing .exe files for windowed PHP applications (created using for example the WinBinder library). It's also good for making stand-alone PHP Socket servers/clients (using the php_sockets.dll extension). It's NOT really a compiler in the sense that it doesn't produce native machine code from PHP sources, but it works!
ZZEE PHPExe :
ZZEE PHPExe compiles PHP, HTML, Javascript, Flash and other web files into Windows GUI exes. You can rapidly develop Windows GUI applications by employing the familiar PHP web paradigm. You can use the same code for online and Windows applications with little or no modification. It is a Commercial product.
phc-win :
The PHP extension bcompiler is used to compile PHP script code into PHP bytecode. This bytecode can be included just like any php file as long as the bcompiler extension is loaded. Once all the bytecode files have been created, a modified Embeder is used to pack all of the project files into the program exe.
Requires
  • php5ts.dll
  • php_win32std.dll
  • php_bcompiler.dll
  • php-embed.ini
ExeOutput :
Commercial
WinBinder :
WinBinder is an open source extension to PHP, the script programming language. It allows PHP programmers to easily build native Windows applications, producing quick and rewarding results with minimum effort. Even short scripts with a few dozen lines can generate a useful program, thanks to the power and flexibility of PHP.
PHPDesktop :
PHP Desktop is an open source project founded by Czarek Tomczak in 2012 to provide a way for developing native desktop applications using web technologies such as PHP, HTML5, JavaScript & SQLite. This project is more than just a PHP to EXE compiler, it embeds a web-browser (Internet Explorer or Chrome embedded), a Mongoose web-server and a PHP interpreter. The development workflow you are used to remains the same, the step of turning an existing website into a desktop application is basically a matter of copying it to "www/" directory. Using SQLite database is optional, you could embed mysql/postgresql database in application's installer.
PHP Nightrain :
Using PHP Nightrain you will be able to deploy and run HTML, CSS, JavaScript and PHP web applications as a native desktop application on Windows, Mac and the Linux operating systems. Popular PHP Frameworks (e.g. CakePHP, Laravel, Drupal, etc…) are well supported!
phc-win "fork" :
A more-or-less forked version of phc-win, it uses the same techniques as phc-win but supports almost all modern PHP versions. (5.3, 5.4, 5.5, 5.6, etc) It also can use Enigma VB to combine the php5ts.dll with your exe, aswell as UPX compress it. Lastly, it has win32std and winbinder compilied statically into PHP.
EDIT :
Another option is to use
an online compiler that can build executables for a number of different platforms, from a number of different languages including PHP
TideSDK :
TideSDK is actually the renamed Titanium Desktop project. Titanium remained focused on mobile, and abandoned the desktop version, which was taken over by some people who have open sourced it and dubbed it TideSDK.
Generally, TideSDK uses HTML, CSS and JS to render applications, but it supports scripted languages like PHP, as a plug-in module, as well as other scripting languages like Python and Ruby.

Browsers

Powered by Blogger.

Feature Post

About Me

My photo
B.E.(COMPUTER ENGINEER) PHP Web developer & Provide Training for Web Development , Digital Marketing ,Android Mobile Apps Development

Post Slider (Homepage)

Blog Archive

Malwares

Transfer Files

Media Players

Download Manager

Window

Torrents Soft

Developer Tools

Botton Ad

Ads

Newsletter

 

© 2013 PHP TRAINING IN MUMBAI BY OM SIR . All rights resevered. Designed by OM SIR

Back To Top