By Joe Stump on January 3, 2001 <?php if(isset($submit)) { // Our initial SELECT query – we will build on to it. $sql = “SELECT * FROM link_information AS I, link_categories AS C”; $where[] = ‘ C.categoryID=I.categoryID ‘; // If it’s not “Any” then add on a where claus if($f[‘category’ != ‘all’) { $where[] = ‘ I.categoryID=’.$f[‘category’]; } // If “hits” is a valid number then add on a where clause if(isset($f[‘hits_compare’]) && strlen($f[‘hits_limit’])) { $where[] = ‘ I.hits ‘.$f[‘hits_compare’].’ ‘.$f[‘hits_limit’]; } $sql .= ‘ WHERE ‘.implode(‘ ‘,$where); // decide our limit values if(strlen($f[‘record_limit’]) && strlen($f[‘record_start’])) { $limit = ($f[‘record_limit’] – $f[‘record_start’]); if($f[‘record_start’] >= 0 && $limit >= 0) { $sql .= ‘ LIMIT ‘.$f[‘record_start’].’,’.$limit; } } echo $sql; } ?> That should build intelligent queries for you to then use at your discretion. You…
PHP Tutorials
Whether just getting started or an expert, this vast collection of PHP tutorials will help you create dynamic content for powerful web-based applications in no time.
So you’re interested in AJAX? AJAX is a powerful addition to JavaScript for browser-to-server intercommunication. We will
So you’re interested in AJAX? AJAX is a powerful addition to JavaScript for browser-to-server intercommunication. We will
PHP developers now have a great way to begin using the Jenkins continuous integration server — meet The Template for Jenkins Jobs for PHP
PHP developers now have a great way to begin using the Jenkins continuous integration server — meet The Template for Jenkins Jobs for PHP
By Jess Castagnetto on July 30, 2000 Chances are that at some point in the life of a web site you will need to be creating content on request. Fortunately (yeah, right…), I had to tackle this early in the development of our Metalloprotein Database site at TSRI. There are…
By Jess Castagnetto on July 30, 2000 Where to go from here If you went through the examples and experimented a bit, you will start having more and better ideas on how to use this newfound flexiblity in your site design. You should be able to make more sophisticated interfaces,…
By Jess Castagnetto on July 30, 2000 In the examples below, we will use the database “documents” (non-normalized), in which we will store, for example, the articles published in this site. This database will contain 2 tables: Table: article Fields: id, title, author, published, length, updated, notes Table: body Fields:…
By Jess Castagnetto on July 30, 2000 Example 1: a simple SQL query interface The first thing we will do is to create a simple form, and a script to handle SELECT statements and show the results in tabular form. We will also save the query string for debugging purposes….
By Jess Castagnetto on July 30, 2000 To make things interesting, the form will allow the input of 3 different types of variables: a list of optional keywords for the title (using comma as a separator), a series of checkboxes allowing for multiple selections (treated as an array), and a…