Peter
Peter

Reputation: 62

Using a mysql variable as parameter for AGAINST

I am fetching data from an excelsheet using LOAD DATA INFILE statement and trying to evaluate the results before saving to a database. I need to be able to pass one of the fields from the excel as a mysql variable in the AGAINST() function like AGAINST(@column4) while using MATCH() AGAINST(), but it's not working.

Here's what the code looks like:

    LOAD DATA LOCAL INFILE "'.$uploadedLoanFile.'"
    IGNORE
    INTO TABLE loans_tbl
    FIELDS TERMINATED BY ","
    LINES TERMINATED BY "\n"
    IGNORE 1 LINES
    (@column1, @column2, @column3, @column4, @column5, @column6)
    SET admin_id = "'.$id.'", ippis_no = @column2, f_ap_no = @column3,
    match_status =CASE
      WHEN (SELECT client_fullname FROM customer_tbl 
               WHERE MATCH(client_fullname) AGAINST(@column4 IN BOOLEAN MODE) 
               AND loan_state ='1' AND ippis_no = @column2)  IS NOT NULL THEN "Matched"
               ELSE "Mismatched"
    END,
    uploaded_ippis = @column2, uploaded_name = @column4, client_names = @column4, employer=@column5, 
deduction = @column6, settled = "0", loan_state="1"

Upvotes: 0

Views: 158

Answers (0)

Related Questions