2012-10-14 172 views
0

我在一個wordpress網站上建立一個表格,顯示從一個表格中排序的數據。動態網址mysql php如何到

我不能得到正確的是將標題更改爲一個URL,這是可變的(slug)從同一個數據庫。

基本url保持不變只有slu changes變化 即wwww.thesite.com/job/view/ ---然後是slu。。

這是我的代碼到目前爲止。

function dbTEST($atts, $content = null) { 

// Get all the data from the "job board" table 

$result = mysql_query("SELECT * FROM wpjb_job WHERE job_country='72' ORDER BY job_title") 
or die(mysql_error()); 

echo "<table border='1'>"; 
echo "<tr> <th>Job</th> <th>Company</th> </tr>"; 


// keeps getting the next row until there are no more to get 

while($row = mysql_fetch_array($result)) { 

    // Print out the contents of each row into a table 

    echo "<tr><td>"; 
#---------- I need this job_title to url link to the job_slug 
    echo $row['job_title']; 
    echo $row['job_slug']; 
    echo "</td><td>"; 
    echo $row['company_name']; 
    echo "</td></tr>"; 
} 

echo "</table>"; 
} 

回答

0

試試這個:

echo "<a href=wwww.thesite.com/job/view/".$row['job_slug'].">".$row['job_title']."</a>" 
+0

感謝你,是我得到了什麼,終於,除了我有回聲工作「<一個,而不是回聲「<一個 –