I have to extract a dataset/reorder it, delete the existing dataset from the table and then insert the newly ordered set back in.
However, I "lose" the data after the delete statement, for example:
$result = sqlanywhere_query( $bhbr_conn, "SELECT number(), chlst_val_id, number(), chlst_val_seq_nbr, chlst_cde, chlst_cde_tranl_txt from tb_chl_codetrans where chlst_id = 200298 order by chlst_cde_tranl_txt");
$del_result = sqlanywhere_query( $bhbr_conn, "DELETE FROM TB_CHL_CODETRANS WHERE CHLST_ID = 200298");
while($data = sqlanywhere_fetch_row( $result ) ){
$string2 = "INSERT INTO TB_CHL_CODETRANS (CHLST_ID,CHLST_VAL_ID,CHLST_VAL_SEQ_NBR,CHLST_CDE,CHLST_CDE_TRANL_TXT,CHLST_VAL_SELBL_IND) VALUES ( 200298,{$data['0']},{$data['2']},{$data['4']},'{$data['5']}','N')";
echo $string2;
}
So, in this example, echo $string2 fails to output anything. If I comment out the delete statement $string2 echoes everything correctly.
How can make sure PHP isn't throwing away the data in my first array?
Thanks!
-Rob