Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Forms, php and SQL Queries... help needed for a newbie :-)

New Here ,
Feb 09, 2010 Feb 09, 2010

I have a form with dropdown lists forf the user to choose from, I use the POST method to pass this information to a results.php page. On the results.php I have created a dynamic table to display the results, where I'm having problems is using the Recordset to display the right query... using the WHERE command. It works when I do a single query on one of the fields, (using the Simple section of the recordset popup), but this now only seems to work when I click Test... when I publish the page no results are returned.

2nd problem is then the SQL code for returning records based on more than 1 criteria.

I'm getting myself a bit confused reading the the Dreamweaver help with variables etc, and which I should be using, and do I have to define them or is it automatic?... and whats 'colname;??

All help appreciated. Sorry for al the questions

Thanks

TOPICS
Server side applications
861
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 09, 2010 Feb 09, 2010

loopynutter wrote:

I have a form with dropdown lists forf the user to choose from, I use the POST method to pass this information to a results.php page. On the results.php I have created a dynamic table to display the results, where I'm having problems is using the Recordset to display the right query... using the WHERE command. It works when I do a single query on one of the fields, (using the Simple section of the recordset popup), but this now only seems to work when I click Test... when I publish the page no results are returned.

If you're using the POST method, you need to set the filter to use Form Parameter.

2nd problem is then the SQL code for returning records based on more than 1 criteria.

I'm getting myself a bit confused reading the the Dreamweaver help with variables etc, and which I should be using, and do I have to define them or is it automatic?... and whats 'colname;??

You need to define the variables yourself. Colname is simply the generic name that Dreamweaver gives to a variable that's generated automatically in Simple mode. The following screenshot from my book, "The Essential Guide to Dreamweaver CS4 with CSS, Ajax, and PHP", shows a SQL query that uses two variables that I have called var1 and var2.

adv_recordset.jpg

As you can see, I have defined the values for var1 and var2 in the Variables field by clicking the plus button. You need to set the name, type, default value, and runtime value. You can call the variables anything you like, as long as they don't clash with your table or column names, or use MySQL reserved words.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 09, 2010 Feb 09, 2010
LATEST

Thankyou for the prompt reply David,

I will attempt to set the variables then... but going back to my first query.. I have set the filter to Form Parameter, and at one point did have this working.. but its not now... it works when I click the test button in dreamweaver (it prompts for a search criteria, which I type in and it then returns the correct records), but when I press F12 an view the search page, it forwards through to the results page but no results are returned.

I realise this is me doing something silly somewhere but I've been back over it and cant spot it.

Thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines