Databases Reference
In-Depth Information
C:\> ASSOC .php=PHPScript
C:\> FTYPE PHPScript=C:\Program Files\xampp\php\php.exe %1 %*
You can now type in the name of the script, and it should run automatically:
C:\> hello.cl.php
Hello, world
You can run almost any PHP script from the command line, although some function-
ality, such as sessions, is useful only in the context of web applications. Let's try running
the scripts of Examples 14-2 or 14-3 from the command line; these connect to the
music database and display the artist_id and artist_name :
$ php query_artists.php
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html401/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Artists</title>
</head>
<body>
<h1>Artists</h1>
<table>
<tr>
<th>artist_id</th>
<th>artist_name</th>
</tr>
<tr>
<td>1</td>
<td>New Order</td>
</tr>
<tr>
<td>2</td>
<td>Nick Cave & The Bad Seeds</td>
</tr>
<tr>
<td>3</td>
<td>Miles Davis</td>
</tr>
<tr>
<td>4</td>
<td>The Rolling Stones</td>
</tr>
<tr>
<td>5</td>
<td>The Stone Roses</td>
</tr>
<tr>
<td>6</td>
<td>Kylie Minogue</td>
 
Search WWH ::




Custom Search