dz_boy
08-18-2007, 02:47 PM
I've been using the following SQL query in conjunction with PHP. It works right now, but only when every single field it uses is filled out. Is there a way to modify this query to allow for null values and not to exclude records because of one null field?
SELECT c . item_id , c . cost , c . quantity , c . acquired , c . item_name , c . description , d . location_name , d . location_link FROM `Customer` a , `List_Xref` b , `Item` c , `Location` d WHERE a . customer_id = '. $_COOKIE['user_id'] .' and a . list_id = b . list_id and b . item_id = c . item_id and c . location_id = d . location_id
For example, the location_name or location_link fields are optional for my users. Is there a way to retrieve the rest of the selected information for every record that fits all the other criteria, and then add the location info if it is applicable? I don't think I'm explaining this well... I'm very new at this. Any help or insight is appreciated!
SELECT c . item_id , c . cost , c . quantity , c . acquired , c . item_name , c . description , d . location_name , d . location_link FROM `Customer` a , `List_Xref` b , `Item` c , `Location` d WHERE a . customer_id = '. $_COOKIE['user_id'] .' and a . list_id = b . list_id and b . item_id = c . item_id and c . location_id = d . location_id
For example, the location_name or location_link fields are optional for my users. Is there a way to retrieve the rest of the selected information for every record that fits all the other criteria, and then add the location info if it is applicable? I don't think I'm explaining this well... I'm very new at this. Any help or insight is appreciated!