close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

URL parameter with 2 vaiables

Thread begun 9/17/2009 12:45 pm by colin282897 | Last modified 9/18/2009 8:40 am by Jason Byrnes | 2221 views | 4 replies |

colin282897

URL parameter with 2 vaiables

I have a simple recordset that displays records from a url posted to it.
The record set only looks at one field in a table but I want to be able to send 2 variables to this record set ie send variable1 and variable2 in a url. I then need the record set to show all entries in the table that match either variable1 or variable2.

Currently it looks like this

<?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;
}
}

$colname_company_list = "-1";
if (isset($_GET['region'])) {
$colname_company_list = (get_magic_quotes_gpc()) ? $_GET['region'] : addslashes($_GET['region']);
}
mysql_select_db($database_brighton, $brighton);
$query_company_list = sprintf("SELECT * FROM directory WHERE region = %s ORDER BY listing_type ASC, business_name ASC", GetSQLValueString($colname_company_list, "text"));
$company_list = mysql_query($query_company_list, $brighton) or die(mysql_error());
$row_company_list = mysql_fetch_assoc($company_list);
$totalRows_company_list = mysql_num_rows($company_list);

mysql_select_db($database_brighton, $brighton);
$query_region = "SELECT * FROM regions ORDER BY region ASC";
$region = mysql_query($query_region, $brighton) or die(mysql_error());
$row_region = mysql_fetch_assoc($region);
$totalRows_region = mysql_num_rows($region);
?>

Sign in to reply to this post

Jason ByrnesWebAssist

You need to go into Advanced View to add more conditions to the recordset.

See the following documentation on the Adobe Website for creating Recordsets in advanced view:
WSc78c5058ca073340dcda9110b1f693f21-799ba.html

Sign in to reply to this post

colin282897

Hi Jason

Sorry i'm not a programmer which is why I love Webassist.

the url looks like this filenmae.php?region=xxxx&region=yyyy (this may also be wrong)

how do i add a condition to list the regions that have xxxx OR yyyy in them

Sign in to reply to this post

tom92909Beta Tester

Below is an example of a URL link and processing query that requests (2) dates. Your example would be similar.

html:
<a href="filename.php?Start=xxxx&End=yyyy">MY LINK</a>



php:
$query_getDaterange = "SELECT * FROM my_table WHERE

 Date BETWEEN '".$_GET['Start']."' AND '".$_GET['End']."'";
Sign in to reply to this post

Jason ByrnesWebAssist

You cant have two qurystring variables with the same name. each one needs to have a unique name.

In the advanced view of the Dreamweaver Recordset window, you should already have the first condition set up as an example.

You will need to add another condition to the recordset to filter the other column, the adobe help article I pointed you to will explain how to do this.

Sign in to reply to this post

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...