0
我需要比較兩個表,其中一個有數據,另一個有解釋。比較兩個表與通配符
所以數據表看起來像這樣:
id | state | substate | stage | suppressed
001 wip A1 B3 Y
003 wip A1 B1 N
005 done A2 B3 Y
009 wip A1 B3 N
... and many more similar
解釋表具有以獲得上面的4個狀態(狀態,子狀態中,階段,抑制),並將它們轉換爲人類可讀:
state | substate | stage | suppressed | HRoutput1 | HRoutput2
wip A1 B1 N "it's ok" "wait...dont do anything"
wip A1 B3 N "it's not ok" "better call saul"
done A2 B3 Y "it's not ok" "forget about it"
wip A1 B1 Y "it's ok" "something minor needs to be done"
* * * Y "it's ok" "it's suppressed"
done * * * "it's ok" "it's being worked on"
現在看到,在上述說明表具有2個階段,其中i使用通配符在表
*,*,*,Y,"it's ok","its suppressed"
當狀態,子狀態,階段和抑制在上述任何標準中不匹配時應使用此項。
我做了什麼直到現在,我裝上的數據每行到一個數組A 然後讓元件陣列通過解釋表A中運行:
"SELECT * from explanation_table where state = '" . $data['state'] ."' and '" . $data['substate'] . "' ....etc etc
然後運行查詢和保存結果到一個解釋陣列並打印結果
$data['id'] . $expl['HRoutput1'] . $expl['HRoutput2']
我的代碼工作正常,除了通配符的情況。
哦哇!會嘗試一下:) –