Databases Reference
In-Depth Information
Figure 13-5. Output of query_artists.php shown in a web browser
// ... and print out each of the columns
foreach($row as $data)
print "\t<td>{$data}</td>\n";
// Finish the row
print "</tr>\n";
}
?>
</table>
</body>
</html>
This script doesn't take parameters, and so returns the same results every time unless
you change the data. Its output is shown in Figure 13-5.
To edit the file, you can use any text editor. See “Using a Text Editor” in Chapter 2 for
a discussion of text editors for different operating systems. Once you've typed in the
contents and saved this as the file query_artists.php in the document root of our Apache
web server installation, you can test that it works by loading the URL http://localhost/
query_artists.php in a web browser.
If you do so and get a message like:
Fatal error: Call to undefined function mysql_connect()
you should ensure that your installation of PHP has the MySQL libraries installed. If
you're using RPMs, the libraries are typically in the php-mysql package.
 
Search WWH ::




Custom Search