0

我正在一个 wordpress 网站上构建一个表格,该表格显示从一个表格中排序的数据。

我无法正确地将标题更改为 URL,该 URL 可以从同一个数据库中更改(slug)。

基本 url 保持不变,只有 slug 更改,即wwww.thesite.com/job/view/ --- 然后是 slug。

到目前为止,这是我的代码。

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>";
}
4

1 回答 1

0

试试这个:

echo "<a href=wwww.thesite.com/job/view/".$row['job_slug'].">".$row['job_title']."</a>"
于 2012-10-14T20:09:51.870 回答