I’m using this to to retrieve two columns in a database
while($comment[]=mysql_fetch_array($sql));
this returns an array with associative and number indices for each column.
This works great but I would also like to create a new array from the orginial$comment[] that is just a simple array of strings (only the first column). What are my options? Is there any way to accomplish this without looping through a second time?
Depending on how many columns you have, you could do something like:
$col1will be an array of just column 1’s values, and$col2will be similar for column 2’s values.