How can I use concat, twice in a row in same php form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vuohe
    New Member
    • Mar 2010
    • 1

    How can I use concat, twice in a row in same php form

    Hi I have a form where is two driver selection drop down box. what I'm trying to do is to show only drivers that use that vehicle type.

    in the db there is drivers table and role id from where I'm selecting right drivers to right menus.

    Here are the sql statements, they work okay when only one of these are in use but only the first one when I'm putting both queries in to the form (both are working as expected when commenting out the other one but the other one shows nothing when try to use both):

    Code:
    SELECT CONCAT_WS(' ',drivers.Firstname, drivers.Lastname) AS vehicletypedrivers, user_id, user_roles.role_id
    FROM user_roles
    LEFT JOIN drivers ON user_roles.user_id = drivers.id where user_roles.role_id='2'
    OR user_roles.role2_id= '3'
    
    //then here is the <select>...</select>
    
    SELECT CONCAT_WS(' ',drivers.Firstname,drivers.Lastname) AS vehicletype2drivers, user_id, user_roles.role_id
    FROM user_roles
    LEFT JOIN drivers ON user_roles.user_id = drivers.id where user_roles.role_id='3'
    OR user_roles.role2_id= '2'
    
    //then here is the <select>...</select>
    Last edited by Dormilich; Mar 1 '10, 12:24 PM. Reason: Please use [code] tags when posting code
Working...