Search form

Hi all,

I am trying to make a simple search form and results page.

The problem I have is getting the results page recordset working.

I have the following query that I want to use as a recordset.

SELECT employee.Name,employee.HireDate, DATE_ADD(DATE_ADD(HireDate, INTERVAL yearTable.yearNumber YEAR), INTERVAL ExtendedLeaveDays DAY) AS annDate, yearTable.yearNumber
FROM employee, yearTable
WHERE employee.Name Like 'Name'

I don't know how to set the variable dreamweaver mx for Name.

From what I have read it says to add the variable in the add recordset dialog box by clicking the + and giving it a name and default value of % and runtime value of echo $HTTP_GET_VARS['Name']; but when I do this and click test it errors out.
When I say ok it deletes the recordset.

Help.
LVL 1
blairhenryAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rockmansatticCommented:
since you are using MX,  it would look something like this

<%
Dim Recordset1__Name
Recordset1__Name = "%"
If ($_POST['name'] <> "") Then
  Recordset1__Name = $_POST['name']
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_directory_STRING
Recordset1.Source = "SELECT employee." + Replace(Recordset1__Name, "'", "''") + ",employee.HireDate, DATE_ADD(DATE_ADD(HireDate, INTERVAL yearTable.yearNumber YEAR), INTERVAL ExtendedLeaveDays DAY) AS annDate, yearTable.yearNumber  FROM employee, yearTable  WHERE employee." + Replace(Recordset1__Name, "'", "''") + " Like '" + Replace(Recordset1__Name, "'", "''") + "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>

although this is not the BEST coding.

Rockman

0
rockmansatticCommented:
SORRY, that was ASP.not php


0
rockmansatticCommented:


Here is a simple query to show whats goin on
$var1 = $_POST['var1'];
$var2 = $_POST['var2'];

$query_category = sprintf("SELECT * FROM image_categories WHERE id = %s and class like '%s'", $var1,$var2);



here is what your querys should resmble:
$PassedName = $_POST['name'];

$query_category = sprintf("SELECT employee.Name,employee.HireDate, DATE_ADD(DATE_ADD(HireDate, INTERVAL yearTable.yearNumber YEAR), INTERVAL ExtendedLeaveDays DAY) AS annDate, yearTable.yearNumber
FROM employee, yearTable
WHERE employee.Name Like '%s'",$PassedName);

Hope that clarifies.

Rockman
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

blairhenryAuthor Commented:
This is not really what I am looking for. I want to know how variables are created during the recordset creation within Dreamweaver MX. While using the add recordset(query) button on server bindings tab.
0
rockmansatticCommented:
So you are whating MX to do this for you? and you just want to know how?

OK
since you have a query already
just double click the recordset in the bindings box
click advanced
here you should see your above select statement
'I would change the 'Name' to something more unique such as var_name
BUT I will show using your example
now, click the + just above the Variables
A 'add parameter' dialog box appears
Name should equal Name
Default Value should be %   (this is the all value when using LIKE)
Runtime value shoud be $_POST['name']

when that is done, and you view your code, it should look similar to my prev post.
good luck
rockman
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
blairhenryAuthor Commented:
Thank you this is what I wanted to know.

Do you have any other information on declaring variables in dreamweaver for PHP?
0
rockmansatticCommented:
like what?
to declare vars in php, just

$this_is_the_var_name = "somevalue";

form values or url passed values can be 'collected' like this

$thisvar = $_POST['thisformname'];
$thisothervar= $_GET['thisotherformname'];


Help?

Rockman
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Dreamweaver

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.