close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Help with search

Thread began 10/30/2009 7:11 pm by brobert123392308 | Last modified 11/03/2009 4:50 pm by Jason Byrnes | 1372 views | 9 replies |

brobert123392308

Help with search

I hope someone can help me with issues using D/A on creating a simple search form.
I think these products are amazing with what I have done with them so far. It must be that I'm not understanding this part.

So here goes. Im using D/W cs4, mysql, php. I have D/A and DFP, My db has about 12 columns that I need to have a search page to search about 3 fields, primarily a date range, a "country" column, and maybe one more.

I have used the D/A search wizard many times and nothing happens when you hit submit but a blank page comes up.

Using the D/A wizard creates the pages but nothing happens when the submit button is hit.
I have read all the documentation I can find and it just doesnt work.
Can someone assist me, I have to launch this site Wednesday and everything else works great but this.

Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

If you are getting a blank page, then it means a php error is occurring, but error reporting is turned off.

Add the following to line 1 of the page to turn error reporting on:

php:
<?php

error_reporting
(E_ALL);
ini_set('display_errors','on');
?>





as for the page created by the wizard not working, I would need to see the code on the search and results page to see what is wrong.

Sign in to reply to this post

brobert123392308

thanks Jason

Thanks for the reply Jason, I will be back on Monday to deal with the issue. I hope you can help me out then, I will post the code then.

Thank you and have a good weekend

Robert

Sign in to reply to this post

Jason ByrnesWebAssist

OK, you too.

Sign in to reply to this post

brobert123392308

Help with search

Hi Jason, here is the code for the search page for the date range. Can you tell me what I need to do to get this functional? This page has 2 text fields and a submit button.

thanks

Robert





<?php
//WA Database Search Include
require_once("WADbSearch/HelperPHP.php");
?>
<?php
//WA Database Search (Copyright 2005, WebAssist.com)
//Recordset: Recordset1;
//Searchpage: searchagain.php;
//Form: form1;
$WADbSearch1_DefaultWhere = "";
if (!session_id()) session_start();
if ((isset($_POST["WADbSearch1"])) && ($_POST["WADbSearch1"] != "")) {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
//keyword array declarations
$KeyArr0 = array("id", "last_name", "first_name", "primary_email", "secondary_email", "city", "county", "state_us", "province_ca", "country", "event_country", "event_state_us", "event_province_ca", "event_city", "event_county", "short_description", "long_description", "_shape");

//comparison list additions
$WADbSearch1->keywordComparison($KeyArr0,"".((isset($_POST["search"]))?$_POST["search"]:"") ."","AND","Includes",",%20","%20","%22","%22",0);

//save the query in a session variable
if (1 == 1) {
$_SESSION["WADbSearch1_searchagain"]=$WADbSearch1->whereClause;
}
}
else {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
//get the filter definition from a session variable
if (1 == 1) {
if (isset($_SESSION["WADbSearch1_searchagain"]) && $_SESSION["WADbSearch1_searchagain"] != "") {
$WADbSearch1->whereClause = $_SESSION["WADbSearch1_searchagain"];
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
$WADbSearch1->whereClause = str_replace("\\''", "''", $WADbSearch1->whereClause);
$WADbSearch1whereClause = '';
?>
<?php require_once('Connections/connNids.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
mysql_select_db($database_connNids, $connNids);
$query_Recordset1 = "SELECT * FROM Report";
setQueryBuilderSource($query_Recordset1,$WADbSearch1,false);
$Recordset1 = mysql_query($query_Recordset1, $connNids) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="mystyles.css" rel="stylesheet" type="text/css" />
</head>

<body>
<form id="form1" name="form1" method="post" action="searchagain.php">
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>
<label>Between
<input type="text" name="Between" id="Between" />
</label>
&nbsp;
<label>And
<input type="text" name="And" id="And" />
</label>
</p>
<p>&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
<label>
<input type="submit" name="Submit2" id="Submit2" value="Submit" />
</label>
&nbsp; </p>
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td align="center"><input type="hidden" name="WADbSearch1" value="Submit" /></td>
</tr>
</table>
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>

Sign in to reply to this post

Jason ByrnesWebAssist

the dataassist search behavior is set to use a form element named search:
$WADbSearch1->keywordComparison($KeyArr0,"".((isset($_POST["search"]))?$_POST["search"]:"") ."","AND","Includes",",%20","%20","%22","%22",0 );



that does not exist in your form.

Sign in to reply to this post

brobert123392308

new one

OK Jason,
I recreated the form as below, why can't I get any results to show up?


thanks for your help




<?php
error_reporting(E_ALL);
ini_set('display_errors','on');
?>
<?php require_once('Connections/connNids.php'); ?>
<?php
//WA Database Search Include
require_once("WADbSearch/HelperPHP.php");
?>
<?php
//WA Database Search (Copyright 2005, WebAssist.com)
//Recordset: Recordset1;
//Searchpage: dbsearch.php;
//Form: form1;
$WADbSearch1_DefaultWhere = "";
if (!session_id()) session_start();
if ((isset($_POST["WADbSearch1"])) && ($_POST["WADbSearch1"] != "")) {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
//keyword array declarations
$KeyArr0 = array("id", "submittedDate", "state_us", "province_ca", "country", "event_date", "event_country", "event_state_us", "event_province_ca", "short_description", "long_description", "_fivehundfeet");

//comparison list additions
$WADbSearch1->keywordComparison($KeyArr0,"".((isset($_POST["search"]))?$_POST["search"]:"") ."","AND","Includes",",%20","%20","%22","%22",0);

//save the query in a session variable
if (1 == 1) {
$_SESSION["WADbSearch1_dbsearch"]=$WADbSearch1->whereClause;
}
}
else {
$WADbSearch1 = new FilterDef;
$WADbSearch1->initializeQueryBuilder("MYSQL","1");
//get the filter definition from a session variable
if (1 == 1) {
if (isset($_SESSION["WADbSearch1_dbsearch"]) && $_SESSION["WADbSearch1_dbsearch"] != "") {
$WADbSearch1->whereClause = $_SESSION["WADbSearch1_dbsearch"];
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
else {
$WADbSearch1->whereClause = $WADbSearch1_DefaultWhere;
}
}
$WADbSearch1->whereClause = str_replace("\\''", "''", $WADbSearch1->whereClause);
$WADbSearch1whereClause = '';
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

mysql_select_db($database_connNids, $connNids);
$query_Recordset1 = "SELECT * FROM Report";
setQueryBuilderSource($query_Recordset1,$WADbSearch1,false);
$Recordset1 = mysql_query($query_Recordset1, $connNids) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="mystyles.css" rel="stylesheet" type="text/css" />
</head>

<body>
<form id="form1" name="form1" method="post" action="dbsearch.php">
<label>search
<input type="text" name="search" id="search" />
</label>
<label>submit
<input type="submit" name="submit" id="submit" value="Submit" />
</label>
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td align="center"><input type="hidden" name="WADbSearch1" value="Submit" /></td>
</tr>
</table>
</form>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>

Sign in to reply to this post

Jason ByrnesWebAssist

please post a link so I can investigate.

Sign in to reply to this post

brobert123392308

a link?

You want a link to the site? It's not public yet, can I send it private?

Sign in to reply to this post

Jason ByrnesWebAssist

OK, I have created a support ticket so you can send the link.


To view and edit your support ticket, please log into your support history:
supporthistory.php?

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...