0

我正在尝试填充使用( port_id=$project )创建的页面。单个帖子页面有效,并且正在填充,但由整个表而不是仅具有相同 ID 的行填充。这是我的单页代码:

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

1 回答 1

0

You should could call the $currportfolio variable first, and then add it into the query

$sql = 'SELECT * FROM portfolio WHERE port_id = $currportfolio ';

Then you are only calling the values from that specific row.

于 2013-09-03T01:33:43.337 回答