Where Clause using a mixture of letters and numbers

Hi There,

I have a where clause that is searching for a result that sometimes has numbers and letters in it.
For Example 3680c01 when I click on that result it takes me to an error - Unknown column ‘3680c01’ in ‘where clause’. If I click on a number that says 3680 it includes all the results from 3680 as well as 3680c01. I tried doing a search to find an answer but I cannot seem to find one that works for my situation.

[php]SELECT Orders.Order_Date_ID, Orders.Invoice_Number, Colors.Color_Name, Parts.Part_Name, Orders.PartID, Orders.Qty
FROM Stores
LEFT JOIN Parts
LEFT JOIN Colors
LEFT JOIN Orders ON Colors.ColorID = Orders.ColorID
ON Parts.PartID = Orders.PartID
ON Stores.StoreID = Orders.StoreID
WHERE Orders.PartID=$iPartID;[/php]

You need quotes. Numbers only dont need them

WHERE Orders.PartID=[size=18pt][/size]$iPartID[size=18pt][/size];

You should be using ALL lowercase for your tables and column names as well as variables and avoid abbreviations like Qty. just spell it out. Separate multiple_words_with_an_underscore.

On the plus side, it appears you have a Normalized database which is very good.

Thanks, That did the trick. And I will take your suggestion regarding the lower case lettering and not using abbreviations.

Sponsor our Newsletter | Privacy Policy | Terms of Service