如何在while循環中添加多個值,我只能根據我的級別添加兩個值,一個是id,另一個是標題,我想添加更像是我的字段是從服務器獲取請幫助任何人如何在PHP中while循環中從數組中調用多個值
$limitStart = $_POST['limitStart'];
$limitCount = 15;
if(isset($limitStart) || !empty($limitstart)) {
$con = mysqli_connect($hostname, $username, $password, $dbname);
$query = 'SELECT id, title, caption, description, featured_image, logo, category_sku, industry_sku
FROM works ORDER BY title limit '.$limitStart.','.$limitCount .'';
$result = mysqli_query($con, $query);
$res = array();
while ($resultSet = mysqli_fetch_assoc($result)) {
$res[$resultSet['id']] = $resultSet['featured_image'];
}
echo json_encode($res);
}
只獲取一個Id相關的數據,還有其他很多的id。 –
您可以發佈數據存儲結構嗎? –