我在我的profileTable中有一列叫做「關聯」...我試圖查詢關聯關係的關聯關係。在PHP/MySQL查詢中創建關聯數組
$sql = mysqli_query($con,"SELECT * FROM profileTable WHERE Keyword_ID LIKE
'%".$getKeyID."%' ORDER BY Associations <> 'School of Engineering
and Computer Science', Associations AND LaName ASC LIMIT $start,$end");
我能夠通過教育索引配置文件,但不是通過Association。
while ($row = mysqli_fetch_array($sql)) {
$key = $row['Keyword_Name'];
$keyID = $row['Keyword_ID'];
$fname = $row['FirName'];
$lname = $row['LaName'];
$mname = $row['MName'];
$suffix = $row['Suffix'];
$title = $row['Title'];
$title2 = $row['Title2'];
$title3 = $row['Title3'];
$education = $row['Education'];
$education2 = $row['Education2'];
$education3 = $row['Education3'];
$dept = $row['Dept'];
$phone1 = $row['PH1'];
$phone2 = $row['PH2'];
$email = $row['Email'];
$photo = $row['Photo'];
$bio = $row['BioLK'];
$website = $row['Website'];
$assocs = $row['Associations'];
$actions=array('School of Engineering and Computer Science'=>'Computer Science
and Engineering');
我需要涉及與$鍵(字)的關聯,所以如果某個關鍵字用戶點擊「計算機」,它將涉及到「工程和計算機科學學院」和索引那些在「學校首先是「工程與計算機科學」。
這工作正常與其他列像「教育」,但似乎無法讓它與我的關聯數組一起工作。有任何想法嗎?
例如sqlfiddle:http://sqlfiddle.com/#!2/c1802/7/0
問題:爲什麼你將這一行解壓縮爲一百萬個變量? –
?? @ Mike'Pomax'Kamermans解釋... – MizAkita
不,這是完整的問題。你有一個包含所有數據的數據容器,爲什麼要將它解壓縮到20個變量,而不是在需要使用它的代碼段中使用關聯數據數組?這隻會讓你的代碼變得不必要的巨大,沒有任何真正的好處(例如$ title1與$ data [「title1」]一樣清晰) –