my problem is with rows mysql_query. I need:
Record 0: 2,text is text,3.23
But I have:
Record 0: 2
Record 1: text
Record 2: is
Record 3: text
Record 4: 3.23
Please help me.
results=($(mysql --user root -proot test -Bse "select id,name from Object"));
cnt=${#results[@]}
for (( i=0 ; i<${cnt} ; i++ ))
do
echo "Record No. $i: ${results[$i]}"
fieldA=${results[0]};
fieldB=${results[1]};
done
fieldAandfieldBinside theforloop; if you want those to contain certain parts of each record, you shouldn't assign whole records to them.