PHP가 새로워졌습니다! 카테고리 이름에서 여러 제품을 선택하고 싶지만 결과가 없습니다. 어떤 제안? PHP 가입 테이블에서 선택
나는 MS 액세스에서 만든 제품 테이블과 범주 테이블이 : Category
필드 CategoryID
, ProductID
및 헤드, 조각과 Category
, 그리고 꽃병 기록이다.
Products
필드 ProductID
, ProductName
, Price
및 Details
있습니다. 이 두 테이블에서 데이터를 가져옵니다 있도록
$conn = new COM("ADODB.Connection") or die("Cannot start ADO");
$connString= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\\ectserver\\AHARDEN2\\Database\\products.mdb";
//creates the connection object and define the connection string
$conn->Open($connString);
$selectCommand="SELECT ProductName, Price, Details FROM Products WHERE ProductID = Head";
$rs = $conn->Execute($selectCommand);
//opens a recordset from the connection object
if (!$rs->EOF){
$ProductName = $rs->Fields("ProductName");
$Price = $rs->Fields("Price");
$Details = $rs->Fields("Details");
}
print "You selected the following product last time:<p>";
print "<div id=\"category\"> ";
print "Product Name: $ProductName<br>";
print "Price: $Price<br>";
print "Details: $Details<br>";
print "</div>";
$rs->Close;
SQL JOIN을 사용해야합니다. 더 많은 SQL과 PHP 문제가 더 적습니다. –
나는 당신을 팔로우하지 않습니다. 더 자세히 설명해 주시겠습니까? 내가 가지고있는 책은 내가 이것을 위해 필요하다는 것을 보여주지는 못하지만 나는 전문가가 아니므로 본보기를 얻을 수있다. – Nerdysyntax