Tom Muck

Alpha Dog Blues Band
Home page
All articles | DWTeam | Flash Remoting | Basic-Ultradev | Community MX
All Extensions | Extension News | Extension FAQs | Customer Login
Books authored or co-authored by Tom Muck
Extensions, books, and other products | Customer Login
Your current cart contents
Tom-Muck.com Blog | CMXTraneous Blog | Flash Remoting Blog
About the site

Faq

Dynamic Search Suite PHP: Frequently Asked Questions

Q: Does the extension work with Dreamweaver MX and Dreamweaver MX 2004?

A: Yes.


Q: Does the extension work with hand-coded pages?

A: No. The extension works in conjunction with pages that use the Dreamweaver MX recordsets.


Q: I get this error when I do a search:

You have an error in your SQL syntax near 'LIKE /'%test%/') OR (field2
LIKE /'%test%/'))) ' at line 1

A: This is due to the code that Dreamweaver inserts into the Recordset, and only affects some users. There are three options to avoid the problem:

1. Download this patch. This will change the behavior of the Dynamic Search extension so that it uses a custom parameter rather than a standard Dreamweaver parameter. This will unfortunately render the DW recordset uneditable in the DW environment if there is an additional WHERE clause in your SQL statement.

2. Change this line:

$tfmsqlstr_Recordset1 = (get_magic_quotes_gpc()) ? $tfmsqlstr : addslashes($tfmsqlstr);

to this:

$tfmsqlstr_Recordset1 = $tfmsqlstr;

This will eliminate the source of the problem: the addslashes() function.

3. Change the php.ini file to turn on magic quotes:

magic_quotes_gpc = on

A search on Google will turn up information on magic_quotes:
http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=php+magic_quotes


Q: Do I need to enter anything in the second tab (Advanced)?

A: Only if you want to add some of the more advanced features, such as adding radio buttons/select box for Any Words, All Words, and Exact Phrase searches, or if you have an existing WHERE clause that you want to keep in addition to the new WHERE clause written by the server behavior


 

Q: Does the extension work with UltraDev?

A: No.


Q: I tried to apply the extension to a table that displays the results of a stored procedure, but it isn't searching. Does it work with stored procedures?

A: It won't work with a standard stored procedure that returns a resultset because the SQL is generated dynamically by the extension. However, through careful hand coding you can adapt your stored procedure to accept a dynamic WHERE clause and make use of the extension. The extension is not supported for this type of page, though.


Q: I'm using the Sort Repeat extension on a search page, but when I click the table heading, I lose the search parameters.

A: There could be one of two problems: either you didn't fill in the box for "Use These Parameters" in the Sort Repeat Region extension, or you are using a Form-specifc variable reference in your recordset (POST variables). Search forms should be set to GET to avoid this problem.


Q: Does this server behavior work with the Recordset Navigation Suite or the Sort Repeat Region server behavior?

A: Yes, it is fully compatible with those extensions.


Q: Which PHP server model does the extension work with?

A: It works with the MySQL server model in Dreamweaver 6 and higher.


Q: Can I use the extension with two recordsets or search two tables in a database?

A: There is really no way to do this with a standard search, but you can do it in a View (SQL Server) or Query (Access), and then use that on your page instead of the database table. In order for that to work, you have to create a view that uses a UNION, and the fields have to match. I usually give each column name an alias if the table columns don't match, like this:

SELECT table1_myfield as myfield
, table1_myfield2 as myfield2
, table1_myfield3 as myfield3
, '' as myfield4
FROM table1

UNION

SELECT table2_anotherfield as myfield
, table2_anotherfield2 as myfield2
, table2_anotherfield3 as myfield3
, table2_anotherfield4 as myfield4
FROM table1

ORDER BY myField, myField2, myField3,myField4

Notice that the first table in my query is short by one column, so I merely created an alias to an empty string to complete the UNION. Then you merely have to use the View in your page:

SELECT * FROM myView

If your database does not support views, you might be able to code the SQL in your page instead.

Q: Using the PHP version, can I use the extension the POST method and return multiple results pages using recordset navigation?

A: Unfortunately, this is a function of the navigation behaviors. They are set up to use the query string, not the form post. Indeed, the only advantage to using a POST method is to hide the parameters from the user, but recordset navigation will not work with a hidden query string. For that reason, it is better to use the GET method when dealing with multi-page search results.

Having said that, there is a way to add the post variable to the querystring:

after this section appears:

if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
  $params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_Recordset1") == false &&
      stristr($param, "totalRows_Recordset1") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_Recordset1 = "&" . implode("&", $newParams);
  }
}

add this code:

if(isset($_POST["search"])) {
  $queryString_Recordset1 = sprintf("&search=%s%s", $_POST["search"], $queryString_Recordset1);
}

Substitute your own search parameter and your own recordset name.

Pay me securely with your Visa, MasterCard, Discover, or American Express card through PayPal!
Pay me securely with your Visa, MasterCard, Discover, or American Express card through PayPal!
About | Privacy Policy | Contact | License Agreement | ©2002-2017 Tom Muck | Dreamweaver Extensions