我已經在同一個數據庫中安裝了wordpress和opencart。試圖獲得opencart模塊內的WordPress的帖子表。得到了mysql查詢來獲取除圖像以外的所有信息。我不是爲什麼圖像與結果循環中的帖子不同。請指導,以下是代碼。如何通過類別與圖像獲得WordPress的帖子
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "tablename";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {die("Connection failed: " . $conn->connect_error);}
$sql = "SELECT * FROM wp_posts WHERE post_type = 'attachment' ORDER BY ID DESC LIMIT 3";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo '<div class="col-sm-4">';
echo "Post ID: " . $row["ID"] . "/";
echo "Post Title: " . $row["post_title"] . "/";
echo "Post Title: " . $row["post_date"] . "/";
echo '<img src="' . $row['guid'] . '" class="img-responsive">';
echo '</div>';
}
} else {
echo "0 results";
}
你想在WordPress或Opencart的模塊 –
Opencart的有博客文章的一部分,從而顯示圖像...在Opencart的模塊 –
任何人都可以引導 –