LiveSQL lets users bookmark a query (or other SQL statement) in their
browsers. By clicking on the link, the query is executed and data
returned in several common formats. But what's that mean for PHP
developers?
As you know, PHP makes it easy to read a web page using a URL. The
fopen function really does all the work. LiveSQL lets you create a
a simple URL that BadBlue can use as a SQL statement. For instance, a
URL that selects all fields and records from the inventory table of an
Access database might look like this:
http://yourserver/...sql=select+*+from+inventory...
Note the SQL portion of the URL ("select * from inventory"). Your
PHP code can simply "fopen" the URL and immediately start reading
the resulting query data in comma-separated, tab-delimited or
XML format.
The following code snippet takes advantage of the fopen function and
runs a URL that performs the select:
<html><title>LiveSQL Test</title><body><font face="verdana,arial">
<?php
$sURL = "http://..."; // URL from LiveSQL test page
$fd = fopen($sURL, "r");
if ($fd) {
while (!feof($fd)) {
$sTemp = fgets($fd, 4096);
$aTemp = explode("\t", $sTemp);
for ($n = 0; $n < sizeof($aTemp); $n++) {
//
// Each array item now contains a field ready to
// saved or displayed...
//
}
}
fclose($fd);
}
?>
</body></html>
This example uses a URL that generated tab-delimited data. Each line
is read using the 'fgets' function into a temporary string variable
named 'stemp'. That variable is then exploded into an array so that
each field can be easily managed.
Try LiveSQL free (it's a record-limited version, but fully functional).
Or purchase Enterprise Edition and get complete LiveSQL support, file
uploads, one-touch publishing of Excel, Word and Access files,
customizable system tray menus - and more. Get all the features of Enterprise Edition!
Companies Using PHP
Lastly, we'll wrap up with our traditional list of large or otherwise
significant organizations that are using PHP to drive their businesses:
CapitalOne, NASA, the W3C, HP, Google, Deutsche Bank, Redhat,
Lycos, Cisco, Ericsson, Volvo, Motorola, SourceForge, Honda, Xoom,
WinAmp, Sony Music, Vodafone, CBS, Cap Gemini Ernst & Young,
the US Army, UPI, the New York Yankees, Southwestern Bell,
the San Diego Zoo, the Oakland Raiders, Audi, Subaru, VA Linux,
Winamp, Duke University, Quicken, The Village Voice, Undernet,
Access Micro, Columbus Dispatch, Indianapolis Star, Yahoo,
Indiana University, Deutsche Telecomm, Bang & Olufsen, Siemens,
Unilever, Philips, BMC, NTT, Air Canada, Lufthansa, Dialpad, BMC,
Mitsubishi, MP3.com, the Arizona Republic, Deloitte Consulting