「res_properties」というテーブルの内容を印刷して、ポートフォリオの概要を取得したいのですが、構文についてはわかりません (PHP は私を知っていますが、私は PHP を知りません...):
「res_properties」と呼ばれるテーブルと「location_id」と呼ばれる列があり、「res_location」と呼ばれる別のテーブルと「id」と「slug」と呼ばれる2つの列があり、列「slug」には人間が読める場所のコンテンツが含まれます
サンプルの「id」は「3」で「California」(「slug」の内容)、「id」は「4」で「Virginia」(「slug」の内容)などです。
印刷するときは、テーブル「res_location」をルックアップする必要があり、「location_id」が「id」と等しい場合は、「id」を「slug」のコンテンツに置き換えます (または、「slug」のコンテンツを「location_name」などの新しいフィールドに移動します) ' (25 文字) を入力し、そのフィールドを出力します。
これまでのところ、私のコードはこれであり、助けていただければ幸いです。どうもありがとう:
<html>
<head>
<title>Portfolio</title>
</head>
<link rel="stylesheet" type="text/css" href="../scripts/css/formate.css" />
<body>
<?php 
 // Connects to Database 
 mysql_connect("localhost","user","passw") or die(mysql_error()); 
 mysql_select_db("db_name") or die(mysql_error()); 
 $data = mysql_query("SELECT * FROM res_properties"); 
 $location = mysql_query("SELECT * FROM res_locations")
 or die(mysql_error()); 
 Print "<table border cellpadding=3>"; 
 Print "<br><h3>Portfolio</h3><p><br>"; 
   Print "<table border cellpadding=3>"; 
   Print "<tr align='left'><th width=130>Villa Name</th><th width=40>Beds</th><th width=40>Baths</th><th width=60>Sleeps</th><th width=40>Location</th><th width=40>Loc-ID</th><th width=300 >Site URL</th></tr>"; 
   while($info2 = mysql_fetch_array( $location )) 
   while($info = mysql_fetch_array( $data )) 
 { 
 Print "<tr>"; 
 Print "<td>".$info['ref_id'] . "</td> "; 
 Print "<td>".$info['bedrooms'] . " </td>"; 
 Print "<td>".$info['bathrooms'] . " </td>"; 
 Print "<td>".$info['max_occupants'] . " </td>"; 
 Print "<td>".$info2['slug'] . " </td>"; 
 Print "<td>".$info2['id'] . " </td>"; 
// here I want to print a clickable URL but some syntax error:
// Print "<td>" http://www.domain_name.com/'.$info['slug'] .'.html;
// when using the echo command it works fine like this, but doesn't output a clickable URL:
// echo 'http://www.domain_name.com/'.$info['slug'] .'.html' . "<br />"; 
 } 
 Print "</table>"; 
 ?> 
</body>
</html>