Access-PHP Connectivity

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply

Using ACCESS as database is good idea?

Poll ended at Fri Mar 17, 2006 6:07 am

yes
0
No votes
No
2
100%
 
Total votes: 2

harsh
Forum Newbie
Posts: 1
Joined: Tue Mar 07, 2006 5:57 am
Location: India
Contact:

Access-PHP Connectivity

Post by harsh »

Dear Sir,
I want to know how Access-PHP connectivity can be done. Please send me the code of Access-PHP connectivity on my email id or when you will place its answer then please inform me.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Roja wrote:This is a *learning* site. We help you learn how to do things. Teach a man to fish and he can feed himself for life, ya know?

The alternative (giving you the finished product) is called work. Most people here get paid (a lot) to do that. In most discussions the rate is between $35-$65 US dollars per hour.

I'm sure someone is willing to do it at that rate. If you aren't willing to pay for someone to do work to specification, perhaps you might enjoy learning how to do it yourself, so you can one day charge others.

That service - teaching you a valuable skill - we offer for free here. What a value.
shahid_computer
Forum Newbie
Posts: 2
Joined: Sat Mar 18, 2006 12:46 am

ms access + PHP

Post by shahid_computer »

feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


This code is to connect and select data from ms access via php 
I want to have a code for insertion data in ms access via php.

Code: Select all

<?php
	$ipaddress = $HTTP_POST_VARS["ipaddress"];
	echo	"  <form action=\"" . $_SERVER['PHP_SELF'] . "\" method=\"POST\">\n";
	echo	"    <input type=\"text\" name=\"ipaddress\">\n";
	echo	"    <input type=\"submit\" name=\"submit\" value=\"submit\">\n";
	echo	"  </form>\n";
	
	if (isset($HTTP_POST_VARS["ipaddress"])) {
	$ipaddress;
			
	// getcwd() required >= PHP4
	$accesspath = getcwd() . "\\Country.mdb";
	$conn = new COM("ADODB.Connection") or die("Cannot start ADO"); 
	// Microsoft Access connection string.
	$conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" . $accesspath);
	// SQL statement to build recordset.
	//$rs = $conn->Execute("SELECT * FROM IPCountry WHERE
                " . $ipno . " BETWEEN IPCountry.ipFROM    AND IPCountry.ipTO");
	$rs = $conn->Execute("insert into IPCountry set ipTO=". $ipaddress);
	     echo	"<p>";
	echo	"<h1><u>Lookup Result</u></h1>";
	echo	"<table>";
	echo	"<tr><td>IP Address :</td><td> <b>" . $ipaddress . "</b></td></tr>\n";
					
	$fv = $rs->Fields("countrySHORT");
	$fv->value=$ipaddress;
	echo "<tr><td>Country Name (Short) :</td><td> <b>" . $fv->value . "</b></td></tr>\n";
	$fv = $rs->Fields("countryLONG");
	echo "<tr><td>Country Name (Long)  :</td><td> <b>" . $fv->value . "</b></td></tr>\n";
					

	echo "<tr><td>Country Name (Short) :</td><td> <b> - </b></td></tr>\n";
	echo "<tr><td>Country Name (Long)  :</td><td> <b> - </b></td></tr>\n";
					
					
	echo	"</table>";
	echo	"</p>";
		}
	

	function Dot2LongIP ($IPaddr)
	{
	if ($IPaddr == "") {
	return 0;
	} else {
	$ips = split ("\.", "$IPaddr");
	return ($ips[3] + $ips[2] * 256 + $ips[1] * 256 * 256 + $ips[0] * 256 * 256 * 256);
	}
	}
?>
Regards:
Muhammad Shahid Rasul


feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Post Reply