-1
내 코드에 붙어 있습니다. 배열에 저장된 결과를 다른 배열에 저장하는 방법을 모르겠습니다. 너 나 좀 도와 줄 수있어? 고맙습니다.PHP/MySQL - 결과를 다른 배열에 저장하는 방법?
PHP :
$sql_curr = mysql_query("SELECT * FROM tr_Prices WHERE tr_code = '$acode'");
while($row = mysql_fetch_assoc($sql_cur)){
if($row['price'] != ''){
// there should be array with results if not empty column
}
}
$Arr_Curr = array(
//there should be results from previous array as 'example' => 'example'
);
그래서 while 루프에서는'$ Arr_Curr [] = $ row [ 'price']'를 사용합니다. 또한,'mySql_ *'은 더 이상 사용되지 않습니다. 사용하지 마십시오. mysqli_ * 또는 PDO – Justinas
을 사용하라. 왜 쿼리 자체에서 확인하지 않는가? 'select * from tr_Prices 여기서 tr_code = '$ acode'이고 가격이 null이 아닙니다. ' – sed
@Steve true 좋은 옵션 – user3105439