Advanced search for a price range while checking for an empty values using php in DW

I am creating an advanced search with DW php. I would like to submit a search where some entrys can be left black. So checking for empty values (which I have managed, thank you David Powel), however when searching between multiple price ranges does not seem to work.
please see attached forms:
The search page:
<form action="Detailed-Search-Result.php" method="get" target="_self"><table width="90%" border="0" cellspacing="0" cellpadding="2">
  <tr>
    <td colspan="2"><label for="Detailed Search">Advanced Search</label></td>
    </tr><tr>
    <td><label for="Product">Product:</label>
      </td>
    <td><select name="Category" id="Category">
      <option value=></option>
        <option value="Keyboard">Keyboard</option>
        <option value="Piano">Piano</option>
      </select></td>
  </tr>
  <tr>
    <td><label for="Make">Make:</label>
    </td>
    <td><select name="Manufacturer">
      <option value=></option>
      <option value="Boss">Boss</option>
      <option value="Casio">Casio</option>
      <option value="Kawai">Kawai</option>
      <option value="Ketron">Ketron</option>
      <option value="Korg">Korg</option>
      <option value="Roland">Roland</option>
      <option value="Samson">Samson</option>
      <option value="Yamaha">Yamaha</option>
    </select></td>
  </tr>
  <tr>
    <td><label for="Color">Color:</label></td>
    <td><select name="Color">
      <option value=></option>
      <option value="Black">Black</option>
      <option value="Cherry">Cherry</option>
      <option value="Mahogany">Mahogany</option>
      <option value="Polished Eboney">Polished Eboney</option>
      <option value="Rosewood">Rosewood</option>
      <option value="White">White</option>
      <option value="Red">Red</option>
    </select></td>
  </tr>
  <tr>
    <td><label for="Price">Price:</label></td>
    <td><select name="Price">
      <option value=></option>
      <option value="0-500">£0-500</option>
      <option value="500-1000">£500-1000</option>
      <option value="1000-2000">£1000-2000</option>
      <option value="2000">£2000&gt;</option>
    </select></td>
  </tr>
  <tr>
    <td colspan="2">
      <input name="Search2" type="submit" id="Search2"></td>
    </tr>
    </table>
</form>
The results page
$varCategory_rsgetsearch2 = "%";
if (isset($_GET['Category'])) {
  $varCategory_rsgetsearch2 = $_GET['Category'];
$varMake_rsgetsearch2 = "%";
if (isset($_GET['Manufacturer'])) {
  $varMake_rsgetsearch2 = $_GET['Manufacturer'];
$varColor_rsgetsearch2 = "%";
if (isset($_GET['Color'])) {
  $varColor_rsgetsearch2 = $_GET['Color'];
$varPrice_rsgetsearch2 = "%";
if (isset($_GET['Price'])) {
  $varPrice_rsgetsearch2 = $_GET['Price'];
mysql_select_db($database_dBconn, $dBconn);
$query_rsgetsearch2 = 'SELECT * FROM products';
$where = false;
if (isset($_GET['Category']) && !empty($_GET['Category'])) {
$query_rsgetsearch2 .= ' WHERE Category LIKE varCategory '. GetSQLValueString($_GET['Category'], 'text');
  $where = true;
if (isset($_GET['Manufacturer']) && !empty($_GET['Manufacturer'])) {
  if ($where) {
   $query_rsgetsearch2 .= ' AND ';
  } else {
   $query_rsgetsearch2 .= ' WHERE ';
    $where = true;
$query_rsgetsearch2 .= 'Manufacturer LIKE varManufacturer ' . GetSQLValueString($_GET['Manufacturer'], 'text');
if (isset($_GET['Color']) && !empty($_GET['Color'])) {
    if ($where) {
   $query_rsgetsearch2 .= ' AND ';
  } else {
   $query_rsgetsearch2 .= ' WHERE ';
    $where = true;
  $query_rsgetsearch2 .= 'Color LIKE varColor ' . GetSQLValueString($_GET['Color'], 'text');
if (isset($_GET['Price']) && !empty($_GET['Price'])) {
    if ($where) {
   $query_rsgetsearch2 .= ' AND ';
  } else {
   $query_rsgetsearch2 .= ' WHERE ';
    $where = true;
switch( $_GET['Price'] ){
        case '0-500':
        $query_rsgetsearch2 .= '  RRP BETWEEN 0 AND 500 ORDER BY price ASC'. GetSQLValueString($_GET['Price'], 'text');
        break;
          case '500-1000':
        $query_rsgetsearch2 .= ' RRP BETWEEN 500 AND 1000 ORDER BY price ASC'. GetSQLValueString($_GET['Price'], 'text');
        break;
                    case '1000-2000':
        $query_rsgetsearch2 .= ' RRP BETWEEN 1000 AND 2000 ORDER BY price ASC'. GetSQLValueString($_GET['Price'], 'text');
        break;
          case '2000':
       $query_rsgetsearch2 .= ' RRP BETWEEN 2000 AND 10000 ORDER BY price ASC'. GetSQLValueString($_GET['Price'], 'text');
        break;
$query_rsgetsearch2 = sprintf("SELECT * FROM products WHERE Category LIKE %s AND products.Manufacturer LIKE %s AND products.Color LIKE %s", GetSQLValueString("%" . $varCategory_rsgetsearch2 . "%", "text"),GetSQLValueString("%" . $varMake_rsgetsearch2 . "%", "text"),GetSQLValueString("%" . $varColor_rsgetsearch2 . "%", "text"));
$query_limit_rsgetsearch2 = sprintf("%s LIMIT %d, %d", $query_rsgetsearch2, $startRow_rsgetsearch2, $maxRows_rsgetsearch2);
$rsgetsearch2 = mysql_query($query_limit_rsgetsearch2, $dBconn) or die(mysql_error());
$row_rsgetsearch2 = mysql_fetch_assoc($rsgetsearch2);
I would be greatfull for any help

I have managed to solve the problem.
In the end I didn't check if the values were empty, as it worked fine without. However the switch of the price didn't work in combination with the rest of the query.
I've solved the problem as follows:
$varCategory_rsgetsearch2 = "%";
if (isset($_GET['Category'])) {
  $varCategory_rsgetsearch2 = $_GET['Category'];
$varMake_rsgetsearch2 = "%";
if (isset($_GET['Manufacturer'])) {
  $varMake_rsgetsearch2 = $_GET['Manufacturer'];
$varColor_rsgetsearch2 = "%";
if (isset($_GET['Color'])) {
  $varColor_rsgetsearch2 = $_GET['Color'];
$varPrice_rsgetsearch2 = "%";
if (isset($_GET['Keysound_price'])) {
  $varPrice_rsgetsearch2 = $_GET['price'];
mysql_select_db($database_dBconn, $dBconn);
$query_rsgetsearch2 = sprintf("SELECT * FROM products WHERE Category LIKE %s AND products.Manufacturer LIKE %s AND products.Color LIKE %s", GetSQLValueString("%" . $varCategory_rsgetsearch2 . "%", "text"),GetSQLValueString("%" . $varMake_rsgetsearch2 . "%", "text"),GetSQLValueString("%" . $varColor_rsgetsearch2 . "%", "text") );
switch( $_GET['price'] ){
        case '0-500':
        $query_rsgetsearch2 .= ' AND price BETWEEN 0 AND 500 ORDER BY price ASC';
        break;
          case '500-1000':
        $query_rsgetsearch2 .= ' AND price BETWEEN 500 AND 1000 ORDER BYprice ASC';
        break;
                    case '1000-2000':
        $query_rsgetsearch2 .= ' AND price BETWEEN 1000 AND 2000 ORDER BY price ASC';
        break;
          case '2000':
        $query_rsgetsearch2 .= ' AND price BETWEEN 2000 AND 10000 ORDER BY price ASC';
        break;
$query_limit_rsgetsearch2 = sprintf("%s LIMIT %d, %d", $query_rsgetsearch2, $startRow_rsgetsearch2, $maxRows_rsgetsearch2);
$rsgetsearch2 = mysql_query($query_limit_rsgetsearch2, $dBconn) or die(mysql_error());
$row_rsgetsearch2 = mysql_fetch_assoc($rsgetsearch2);
I'm sure that you can keep the checking for values in, however for me the was no need for it anymore.
Thanks for all your help

Similar Messages

  • Oracle Error occured, while checking for Already Committed data

    Hi,
    In my 1 day old workspace I see more than 3000 errors logged in the owb_error_log_table with text as shown below , can someone from Oracle please advise what the problem seems to be ?
    Oracle Error occured, while checking for Already Committed data : 76291.DBObject.TABLE_1.2.en_GB
    Oracle Error occured, while checking for Already Committed data : 76291.DBObject.TABLE_1.1.en_GB
    Oracle Error occured, while checking for Already Committed data : 42483.PlatformConfiguration.ORACLE.1.en_GB
    Oracle Error occured, while checking for Already Committed data : 42483.PlatformConfiguration.ORACLE.2.en_GB
    There are many more examples of other errors as well. Google returns nothing for these error....am I the first one to face these errors. We are using 11gRelease2 on RHEL.
    They all have a error text of ORA-01403: no data found
    tks in advance.

    I haven't been able to pin it down to a specific action that causes these errors. I have been having various other problems when importing tables ...the screen just freezes and nothing happens. When I queried this table from sql developer to check if I can spot anything and I found these errors.
    The screen freezes when I add a new oracle location - the test works fine - but when I click OK to the add oracle location screen it just freezes and nothing happens.

  • HT1338 when I click on software update it says ''An error occurred while checking for updates.'' Why does it say that?

    So I bought a Powerbook G4 from a pawn shop and yes, I did check to see if it was still good. everything works fine but I need an update because I have OS X 10.3. So I connect to the internet and then I click on ''Software Update'' and I wait. But then a message opens saying ''An error occurred while checking for updates'' And I don't know why. HELP!!!

    Something temporarily wrong with your internet connection?
    Be aware that this is a very large file to download, it needs a strong consistent internet connection.
    Have the iPhone on the charger cable too.
    In the meantime read the threads in this forum about the visibility item and some other possible issues on the 4 and 4S (although a large number of people have these issues, it is still a minor percentage, but anyhow, be aware).

  • "software update"  "An error occurred while checking for updates"

    When I click on "Software Update", an error results, "An error occurred while checking for updates".  It is definitely connected to the internet.  I was gifted a G5 and I installed a new hard drive and loaded the OS, OS X 10.3.5.  That version of Safari does not display pages correctly.  E.g., support.apple.com/downloads just clocks on the righthand side of the page.
    Because cannot access that link, cannot manually update the OS - I was thinking this version is "old" and as a result, unable to connect to apple's update server.  Thanks.

    Thanks,  I upgraded with your info.
    Ultimately, I am trying to access mail.google.com but receiving  the following error with opera v9.5.x: Some important features may not work in this version of your browser, so you have been redirected to the Basic HTML version.
    Safari gives the following: Some important features may not work in this version of your browser, so you have been redirected to the Basic HTML version.
    I can access ask.com and using opera to type this response.

  • ERROR 801881e1 while checking for phone update

    i get the following ERROR 801881e1 while checking for my phone update. I really want some solution. pls help if anyone knows about this. i really want the amber update.

    Try this ..
    Go to settings-->keyboard-->add keyboard and select any .. let it download to the phone .. 
    Now check for the update ...
    If it goes thru' fine, you may remove the added keyboard by again going to settings-->keyboard and long press on the one you want to .. then select 'remove' ..

  • Ios 5.1 OTA update gives error message ( unable to check for update - an error occured while checking for a sofware update ), can anyone help ?

    i am trying to download the latest ios 5.1 but the OTA update gives me a error message ( unable to check for update - an error occured while checking for a sofware update )
    the same thing happens in my ipad too.

    Thank you! I've been trying all day to get this to work! and finally i found the answer!
    amensistech wrote:
    I found a fix for this.
    Go to Wifi    Settings and then select your Wifi Network. Tap the blue arrow to go into Wifi settings and then select the DNS tab.
    Set the DNS to 8.8.8.8 and then go back to the software update page.
    This time it shall work.
    I tried it on an iPad 1 running iOS 5.0.1 but I am sure this shall help.
    Do rate me and reply if it works.

  • An error occured while checking for a software update!

    unable to check for update,an error occured while checking for a software update! thats the one who appear to my setting please help me!

    Hi there,
    You may find the article below helpful.
    iOS: Unable to update or restore
    http://support.apple.com/kb/HT1808
    -Griff W.

  • HT201210 how do I correct - Unable to Check for Update  an error occured while checking for a software update.

    error message:  Unable to check updates.  an error accured while checking for a software update.

    It is all in your WIFI.
    I have 2 internal Wifi networks at home. In one (family) the software update works immediately, in the other one (guess) it gives me the same error "Unable to Check for Udpate" ... The guess network I did set up carries some restrictions being the reason why the update does not work.

  • Wanted to update my ipad wirelessly,went to general,software update,then massage appears:unable to check for update an error occured while checking for software update. How do I fix that?

    Wanted to. Update my ipad2 wirelessly,went to general,software update,then message appers:"unable to check for update an error occurred while checking for a software update." how do I fix that?

    Try set DNS to 8.8.8.8 (do not change the other numbers)
    http://i1224.photobucket.com/albums/ee374/Diavonex/53526605.jpg

  • HT4623 I Can't able to download IOS 7. I n my software update it is giving an error " Unable to check for updates. An error occured while checking for software update". What can be done for this error?

    I Can't able to download IOS 7. I n my software update it is giving an error " Unable to check for updates. An error occured while checking for software update". What can be done for this error?

    Me too having the same thing what's the solution for this how can I update

  • ORA-01423: error encountered while checking for extra rows in exact fetch

    ERROR at line 1:
    ORA-01423: error encountered while checking for extra rows in exact fetch
    ORA-01722: invalid number
    ORA-06512: at "Department.get_emp_name", line 57
    ORA-06512: at line 14
    Hi
    The above are the error messages I am running into and I am not sure what it means at all. I do have a query which select few rows into cursor
    cursor c_requested is
    select * from departments where emp_id in (1, 2, 3)
    now from these rows I again creating a query dynamically
    open c_requested;
    loop
    fetch c_requested into deptID, name, authorized; -- declared variables
    exit when c_requested%NotFound;
    sqlstring := 'Select name from employees where deptID = ' || deptID || ' and Authorized = ' || authorized;
    begin
    execute immediate sqlstring into description; -- declared variable
    exit;
    exception when no_data_found then
    description := 'FILTER_OUT';
    end;
    end loop;
    close c_requested;
    This code is inside a function get_emp_name(). When I execute this function I am getting the above errors. I really appreciate all your help. Please let me know if you need more information.
    Thank you very much

    Thank you very much damorgan,
    I looked through my code and figured out what was wrong. I had a varchar2 column in the table where I was passing a value 999 instead of '999'. Thanks again.
    I have one more question. I am using cursor to loop through.. here is my code
    rowcount integer;
    cursor c_emp is
    select * from employees where empID in (....);
    begin
    open c_emp;
    rowcount := c_emp%RowCount;
    loop
    end loop;
    dbms_output.put_line(rowcount);
    end;
    I am getting rowcount = 0 even though there are many values in it. I am not sure if I am using the where clause properly. Any help would be appreciated.
    thank you.

  • My phone won't let me update software. message is-unable to check for update. An error occurred while checking for software update. What is wrong?

    My IPhone won't let me update software. Mess is- unable to check for update. An error occurred while checking for software update. What is wrong?

    amm wait..first download the latest software (7.1.1) from the verified page..
    then after the download completes.. back up ur device !
    then after the back up completes.. turn off ur device
    after that process jst hold down the home button for about 10 seconds and without leaving the button connect the usb cable to the pc. this process takes ur phone to the recovery mode!
    now on the itunes press (shift ) and then click on update it opens some opener of the files now select the latest software that u've jst downloaded from the internet now there go..

  • On update to 4.0 Firefox locked up while checking for compatability of applications and will not load.

    I have HP a6620f, Vista, 64 bit, 2.5 GHz 4.0 GB RAM. Firefox worked great until I upgraded to 4.0 when it locked up while checking for compatability of applications. I have the desktop ikon but firefox will not come up. Task manager shows firefox.exe using 50% of CPU when terying to come up.

    I've since updated manually to 4.0.1, but haven't yet tried the full uninstall version, because I have to export plenty of settings first (and/or manually copy them). Also means I'd have to start from scratch with many customizations in No Script.
    That said, I'll try the 'Safe Mode' option tonight, thank you :-)!
    If I have to uninstall the whole shebang, I'd be more tempted to go back to 3.6.x until a few more of 4's teething problems (e.g. the messy print dialogues, particularly preview, which regularly doesn't even work) have been tackled.
    Thanks-1M! for now - keep you posted.

  • HT4972 my ipad says an error occurred while checking for software updates

    my ipad says an error occurred while checking for software updates
    my ipad while trying to install updates has stalled it says installing but it is unable to download content??

    Try rebooting your iPad and then see if you have any success updating.
    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up.

  • HT4623 whenever i try to update my software , i got a massage "unable to check for update,an error occurred while checking for a software update'

    whenever i try to update my software , i got a massage "unable to check for update,an error occurred while checking for a software update'

    Your Tag states... iPhone 4S, iOS 6.1.3
    Your Device is currently up to date.

Maybe you are looking for

  • How can I get rid of Shockwave Player Error message? I'm not trying to play anything, but it pops up whenever I reset my Safari.

    I keep getting a message on my Mac saying: Shockwave Player Error To view the movie, open your browser in the 32-bit mode. 1) In Safari, select applications/safari in the Finder and click more info 2) Ensure that Open in 32-bit mode is selected 3) Re

  • CC on two computers but a third one will replace one

    Hello, I've got CC on two computers : my mac at work and my pc at home to make some extra work or emergency if needed. The fact is that my home pc will be replaced at the end of the week by a new one. I'm aware about the fact that my licence gives me

  • Windows updates won't install

    Hello, I have a remote user whose Windows updates won't install. He has a Dell laptop with Windows 7 Pro 32-bit. You can bring up the update windows and start the install but, at exactly 10 seconds, it just says "Updates failed" and doesn't really gi

  • Iphoto is gone, please help

    All the answers say to go retrieve iPhoto from your purchased apps. Mine is not there, nor is it hidden, I cannot drag it from my App folder as it has a white circle with a line through it. I tried retrieving from Time Machine says upgrade is not ava

  • Error Using LISTAGG SQL Function

    Hello, I'm trying to use the new LISTAGG SQL function with the following expression in a report: select listagg(email, ';') within group (order by email) as email_list from sba_registration_entries where team=241 and I get the following SQL error in