How can I retrieve elements of an array in numeric format?
Look at this code:
Expand|Select|Wrap|Line Numbers
- $query = "SELECT price FROM $tbl_name";
- $result = mysql_query($query)
- or die(mysql_error());
- while($row = mysql_fetch_row($result)) {
- //$rowNum++;
- $test[]=$row;
- }
Please pay attention since the elements of column price are numbers I have to retrieve them as numbers.
Outside the while loop I need to to have the elements of $test array as:
Expand|Select|Wrap|Line Numbers
- $element1= 33;
- $element2= 47;
- $element3=65;
echo gettype($element1);
it should NOT SAY "string" that's a NO NO
They should be numbers.
Can anyone help me with this? Please read the question and the code carefully before you answer.
Thanks