我正在尝试填充使用(port_id = $ project)创建的页面。单个帖子页面可以正常运行,但是由WHOLE表而不是仅具有相同ID的Row填充。 这是我的单页代码:
$db = dbconnect('test');
$sql = 'SELECT * FROM portfolio';
$result = $db->query($sql) or die(mysqli_error());
$currportfolio = $_GET['port_id'];
while($row = $result->fetch_assoc()){
$project = $row['port_id'];
echo "
<div class='post-img bottom-50'>
<h3 class='bottom-20'><a href='blog-single.html'>Consectetur adipisicing elit</a></h3>
<div class='proj-img1 bottom-20'>
<a class='prettyPhoto zoom' href='upload/".$row['image']. "'>
<img src='images/content/portimg.jpg' alt=''></a>
</div>
<p>".$row['description'] . "</p>
</div>
</div>
";}
答案 0 :(得分:0)
您应该首先调用$ currportfolio变量,然后将其添加到查询
中$sql = 'SELECT * FROM portfolio WHERE port_id = $currportfolio ';
然后您只调用该特定行的值。