Switch with query works only in part?

I have the following query:

$varSearch_RS_Search = "-1";
if (isset($_GET['Search'])) {
  $varSearch_RS_Search = $_GET['Search'];
}
mysql_select_db($database_dconn, $dconn);
$query_RS_Search = sprintf("SELECT * FROM products WHERE Category LIKE %s OR products.Manufacturer LIKE %s OR products.Model LIKE %s OR products.Color LIKE %s AND Category!= 'Stage Pianos' AND Category!= 'Recent Pianos' AND Category!= 'Recent Keyboards'", GetSQLValueString("%" . $varSearch_RS_Search . "%", "text"),GetSQLValueString("%" . $varSearch_RS_Search . "%", "text"),GetSQLValueString("%" . $varSearch_RS_Search . "%", "text"),GetSQLValueString("%" . $varSearch_RS_Search . "%", "text"));
switch( $_GET['Sort'] ){
    case '':
        $query_RS_Search .= 'ORDER BY price ASC';
        break;
          case 'Low to High':
        $query_RS_Search .= 'ORDER BYprice ASC';
        break;
    case 'High to Low':
        $query_RS_Search .= 'ORDER BYprice DESC';
        break;
    case 'Color':
        $query_RS_Search .= 'ORDER BY Color ASC';
        break;
    case '0-500':
        $query_RS_Search .= 'AND price BETWEEN 0 AND 500 ORDER BY price ASC';
        break;
          case '500-1000':
        $query_RS_Search .= 'AND price BETWEEN 500 AND 1000 ORDER BY price ASC';
        break;
                    case '1000-2000':
        $query_RS_Search .= 'AND price BETWEEN 1000 AND 2000 ORDER BY price ASC';
        break; 
          case '2000':
        $query_RS_Search .= 'AND price BETWEEN 2000 AND 10000 ORDER BY price ASC';
        break; 
  
}


$query_limit_RS_Search = sprintf("%s LIMIT %d, %d", $query_RS_Search, $startRow_RS_Search, $maxRows_RS_Search);
$RS_Search = mysql_query($query_limit_RS_Search, $dconn) or die(mysql_error());
$row_RS_Search = mysql_fetch_assoc($RS_Search);

The switch works great for low to high, high soft color, however whenever I try to go from 0 to 500 it does not select the product between 0 and 500 and the other between the ranges.

I want these switches to operate in this way.

Any help welcome

Sorry I don't have the time to look in detail right now, but don't forget about anytime you mix AND and OR in your WHERE clause, use parentheses to group expressions and make sure you have them treated properly - otherwise they will probably not.

Tags: Dreamweaver

Similar Questions

  • problem with the work only half of the extended keyboard

    have had 2 keyboards with the same problem. They both lost the use of the middle of the keyboard section.

    I would like to test the 2 keyboard in another computer, it doesn't have to be a mac, that a windows box works very well with the mac keyboard

  • Object with actionscript works only on Mac

    I am quite experienced with Dreamweaver and Fireworks, but a newbie to Flash. My first attempt at using the Flash is actually a modification of the tutorial that comes with Flash for the creation of a FMA. You can see mine at http://www.perfectfitweb.com/testing/lightimages/www/lightimages.html. I used the actionscript code in the tutorial and modified to meet my needs. It works perfectly on my machines Windows XP and Windows 98 using IE 6 and Firefox 1.5.0.1. Unfortunately, it does work on my (annoying) client machine. It is on a Mac and when I watched with him, the first image would show upward, but clicking on the next button would do nothing. I put in the Flash detection to provide replacements if it was an older version of Flash or scripts were turned off. After trying this, the client has sent to me, "I still could not make it work." I thought it might have something to do with the Flash Player, so I reinstalled the latest version, but it still does not work with either IE (v 5.2) or Safari (v 2.0.4). I also tried with Firefox (v 1.5.0.6), but the text appeared (no window at all). »

    Could someone out there try it on your Mac, tell me if it works, and give me ideas, why won't work for him?

    Problem solved! I found a friend who let me use his Mac for a few hours and I was able to isolate the problem. I had a few CSS relative positioning and z-index that did not just Mac. I took that and now it works fine. Thank you for your help. Sorry it turned out not to be a problem of Flash at all.

  • Advanced search works only with verification of the equality of the sexes

    Hi all

    I don't know if this is something you can help me or if I'm missing something completely obvious.

    I have a 'advanced search form' which has a few options to check through for example age, city, nationality, etc. and I have two sets of records, one for the user who has the gender are stored in $SameGenderCheck

    And I have a SQL query for the search criteria for the search form.

    Here's the SQL statement:

    $query_search_res = "SELECT * FROM profiles LEFT JOIN profile_details ON profiles.profile_id = profile_details.profile_id WHERE (city = '$location') OR (ethnicity = '$ethnicity' OR nationality = '$nationality' OR marital_history = '$marital_history' OR height = '$height') AND (Age BETWEEN '$age_from' AND '$age_to') AND (gender != '$SameGenderCheck') AND (approved = 'Yes')";
    

    Thank you.

    > other search options are optional, so if they are entered, they will reduce more

    > down search results if they are not then simply use age and city.

    Okay, I think that it is actually the part that is causing problems for you. You want that all the criteria to NARROW your results.  You want to ethnicity, nationality, marital_history and the height to be optional criteria, so you have combined with the rest of the statement with a RC. But an OR condition will always expand results, not close. If you must change the first residence in one and. GOLD is used within the jurisdiction parens for these criteria are OK.

    $query_search_res = "SELECT * PROFILES LEFT JOIN profile_details ON profiles.profile_id = profile_details.profile_id WHERE (city ="$location") AND (ethnicity = nationality GOLD" $ethnicity"="$nationality"marital_history ="$marital_history"height GOLD GOLD ="$height") AND (age BETWEEN '$age_from' AND '$age_to') AND (sex!» (= «$SameGenderCheck») AND (approved = "Yes");

    But here's the problem; If the user has no entry for ethnic origin, nationality, the marital_history and the height of the criteria, no results will be returned. Regular SQL will not solve your problem. You can work around the problem by replacing the equality by the LIKE predicate operator and put a wildcard for users who do not have that criterion in their profile. But that works only for text fields, not digital, and I don't like.

    A better solution is to dynamically create the WHERE clause, remove the criteria of ethnicity, nationality, marital_history and the height of the WHERE clause if the user does not have these fields completed.

  • Index work only with a column of numbers?

    I created a table with a column of data type such as varchar2

    with index I executed the query
    Execution plan
    ----------------------------------------------------------
    Hash value of plan: 2608167055

    ----------------------------------------------------------------------------
    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
    ----------------------------------------------------------------------------
    | 0 | SELECT STATEMENT | 8. 2896 | 2 (0) | 00:00:01 |
    |* 1 | TABLE ACCESS FULL | BOPS_1 | 8. 2896 | 2 (0) | 00:00:01 |
    ----------------------------------------------------------------------------


    After creating Btree index on this column I executed the same query


    Execution plan
    ----------------------------------------------------------
    Hash value of plan: 2608167055

    ----------------------------------------------------------------------------
    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
    ----------------------------------------------------------------------------
    | 0 | SELECT STATEMENT | 8. 2896 | 2 (0) | 00:00:01 |
    |* 1 | TABLE ACCESS FULL | BOPS_1 | 8. 2896 | 2 (0) | 00:00:01 |
    ----------------------------------------------------------------------------



    There is no change between these to explain plans, no performance difference?



    is that B-TREE index works well with number data types?



    Thank you
    REDA

    There could be several reasons. After you create the index statistics gather e.g. also maybe your query returns a huge part of table index will be useless. I mean if you ask him % of 80 percent of one table, optimizer will probably not use index. Another reason, perhaps your table is too small, so oracle read both so the whole table, it is not necessary use index. etc...

    It is not on the varchar2 data type, if one of these conditions is tru that whatever your index of data type will not be used.

    Published by: Mustafa KALAYCI on 20.Eki.2010 10:14

  • RoboForm does not work with your new browser. It is very fustrating and works only with Windows Explorer. I need to reinstall the old FIREFOX program?

    RoboForm does not work with your new browser. It is very fustrating and works only with Windows Explorer. I need to reinstall the old FIREFOX program?

    RoboForm has already released a version with support for the latest version of Firefox. See http://www.roboform.com/support/news. Try upgrading to the latest version of Roboform.

  • Satellite Pro L100 - WLAN works with power current only

    W Lan works only with power supply, not the internal battery (battery) cable. Here is someone who can give me a solution for my problem

    Greetings

    Andreas

    Hello

    Have you tried to disable the option in the WLan card properties?
    If this is not the case, do it!
    I guess that the power save option is enabled and if the laptop works only with battery card don t get enough power.

  • Satellite A130: Fn key not working only not with Vista - only FlashCards

    Hello

    I've been looking around in the forums, but I couldn't find solutions to my problem.

    I have a satellite A130 and I am running a windows VISTA family Basic. I have a problem with my fn functions.
    I can only use flash on the top of my screen cards, just by dragging my mouse upwards on the top of my screen.

    The key works only when I start my computer, at startup, but when the computer is running, there is no other "fn", I could use but my mouse to show my flash cards and use them.

    Is there something else I could do?
    Thank you

    I have same situation, remove the starting windows for the form Flash cards and you have no pictures at the top of the desctop, but keys will work.

  • LabVIEW 2009 .exe works only with windows 2000

    I created a simple vi with Labview 2009 for resetting a counter in the registry key. I changed it to an exe. The program works well on any machine with XP, but it does not work on the machine, that I need on which is running Windows 2000 SP4. I have installed the runtime of 2009, but I keep getting an error when it starts the vi is not executable and I need the full development to correct errors. But like I said it works everywhere else. I tried other exe wrote in LV2009 on this machine and they work. Is there something in my vi which is not compatible with Windows 2000?

    Thank you

    dkfire wrote:

    If you build an exe on a XP machine, then it will work only on XP.

    You need generate the exe on a Windows 2000 machine to make it work.

    Simply not true - even close to not being not right.

    Chris,

    My guess is that the .NET component is not present on the pc of w2k.

  • EXE works only on machines with installed LV

    I've updated a program which brought the following changes:

    Added a whole Panel VI to consolidate data data entry, from control quadrant and added a user input for the default file location.  This VI opens a new front end and closes once completed.  The EXE version of this works only on machines with the installed full LV.

    EXE from the old version to be distributed very well as an exe with the constructor of the app.  Now the new version does not work on the LVRT machines.

    I don't know that miss me a check box in some set up the Panel as "running back" or something like that.  Clues will be greatly appreciated.

    Thank you

    DWH

    Is not in the instr.lib. It is a lvlib in vi.lib analysis. Have you created an installer for the exe or did you just copied the exe file on? You must always use a Setup program. I suspect one of the support files is missing - lvanlys.dll which is supposed to be in the data under the APP folder.

  • Audio & CD/DVD drive not working only not with Vista

    I have a laptop HP V6500 Pressario, with Vista Home Basic installed recently. I have two problems with my laptop:

    1 > there is no sound, and I see the error "no audio device is installed" with a red cross on the "speaker" icon.
    2 > drive CD/DVD is not visible in 'my computer '.

    These two problems are persistent, but begin to work from time to time, say once 20 times when I turn on the laptop, I see the CD drive and also audio works, but these work only for about 10 minutes...

    I tried the Dr.Fixit and it did not help and have also installed the latest drivers for my notebook to the hp site:
    http://h10025.www1.HP.com/ewfrf/wc/softwareCategory?OS=2093&LC=en&cc=us&DLC=en&sw_lang=&product=3550002

    Any help to solve these problems is much appreciated... Thanks in advance

    Hey riri,.
     
    Try these steps and check the result.
    Step 1: Delete the invalid registry keys
    1. Click Start, type regedit and press to enter. If you are prompted for an administrator password or a confirmation, type the password, or click on allow.
    2. in the navigation pane, find and then click the following registry subkey:
    Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\ {4D36E965-E325-11CE-BFC1-08002BE10318}
    3. in the right pane, click UpperFilters.
    Note: You may also see an UpperFilters.bak registry entry. You don't have to delete this entry. Click UpperFilters. If you do not see the UpperFilters registry entry, you may still have to delete the LowerFilters registry entry. To do this, go to step 6.
    4. in the Edit menu, click on delete.
    5. When you are prompted to confirm the deletion, click Yes.
    6. in the right pane, click LowerFilters.
    Note: If you do not see the LowerFilters registry entry, unfortunately this content cannot help you further.
    7. on the Edit menu, click on delete.
    8. When you are prompted to confirm the deletion, click Yes.
    9. exit the registry editor.
    10. restart the computer.
     
    Important: This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click on the number below to view the article in the Microsoft Knowledge Base: see How to back up and restore the registry in Windows
    Step 2: Uninstall any software CD/DVD burning.
    1. Click Start, type appwiz.cpl and press to enter.
    2. from the list of programs, select CD/DVD burning software and click on uninstall.
    3. once the uninstall, restart the computer.
     
    Step 3: Install device drivers in a new user account.
    1. open user accounts by clicking the Start button, clicking Control Panel, click user accounts and family safety (or by clicking on user accounts, if you are connected to a network domain), and then clicking user accounts.
    2. click on manage another account.  If you are prompted for an administrator password or a confirmation, type the password or provide confirmation.
    3. click on create a new account.

    4. type the name you want to assign to the user account, click an account type, and then click on create an account.
     
    I hope this helps.
     
    Kind regards
    Syed - Microsoft technical support.
    Visit our Microsoft answers feedback Forum and let us know what you think.
  • Click right button works only with Windows 7

    My right click button does not work with Windows 7. I had problems with the new cases, but with the help of your part which has been resolved.

    I fixed it!

    When I went to the control panel and the mouse, instead of searching the Internet for the latest update, which it said I already had, I went to my own PC and downloaded the driver and it works now.

    Thank you for your help.

  • Windows 7 works only with canon MX 340

    Canon MX 340 printer works only with windows 7.

    Canon MX 340 printer works only with windows 7.

    You mean the Canon PIXMA MX340?

    You have the following drivers installed? :
    http://www.USA.Canon.com/nw3s/CanonUSA/DownloadContents/English/0100461601EN.htm
    (As of 10/23/12)

  • External speakers work only with powerpoint.

    External speakers work only with powerpoint. DVD, internet, music files, are not. They worked for the first few weeks.

    I have a HP dv7-6c27cl with intel core i5 and Windows 7.

    When I have the system check it, it finds no problem.  Apparently, I have the latest drivers. The fact that the speakers work with powerpoint, which is confusing.

    When I play a video file or music, I get an error message: "Windows Media Player has encountered a problem while playing the file."

    The headset works for internet but not DVD.

    I've installed Weatherbug a week ago and had to uninstall other garbage that come with it. I think that's when the problem started.

    Well, I set myself just now. I did a system restore to a point before that I installed Weatherbug, and now everything's fine.

  • Help! Illustrator crashed unexpected when I work with her. Only a reboot allows, after abandoning the preferences. Who knows what bug this is?

    Help! Illustrator crashed unexpected when I work with her. Only a reboot allows, after abandoning the preferences. Who knows what bug this is?

    If we could, we could make a lot of money, solve problems.

    But unfortunately, we can not just from your description. Please give us the details.

    What version?

    What system?

    Third-party plug-ins?

    All corrupt fonts?

    What hardware is connected?

    You have a printer installed?

    Font management?

    What exactly were you doing when it crashed?

Maybe you are looking for