0
$sqlfees = "SELECT feeid,occurence FROM feedetails WHERE applicablefor='$class'"; 
//fetching data
$fees_query = mysqli_query($db_conx, $sqlfees); 
//executing query
$count = mysqli_num_rows($fees_query);
if($count > 0) {
    while($fetch = mysqli_fetch_array($fees_query)) {
        $feesarr[] = $fetch; //creating array
}

I want to add a new column to $feesarr named 'dates' along with feeid and occurence with some values

8
  • do you want to add dates( not present in table "feedetails") in $feesarr? Commented Apr 3, 2015 at 10:29
  • Can you give example with your expected output array? Commented Apr 3, 2015 at 10:30
  • yes i want to add it as an index with some values like 11/02/2015, 12/02/2015 Commented Apr 3, 2015 at 10:32
  • so that i can do this foreach($feesarr as $row) { echo $row["occurence"]; echo $row["feeid"]; echo $row["dates"]; } Commented Apr 3, 2015 at 10:32
  • echo $row["dates"]; will output values that i will insert seprately specific to each row Commented Apr 3, 2015 at 10:35

1 Answer 1

1

Try something like this

     $sqlfees = "SELECT feeid,occurence FROM feedetails WHERE applicablefor='$class'"; 
     //fetching data
     $fees_query = mysqli_query($db_conx, $sqlfees); 
     //executing query
     $count = mysqli_num_rows($fees_query);
     if($count > 0) {
    while($fetch = mysqli_fetch_array($fees_query)) {
      $new_arr['date'] = $fetch['id'].'/'.other field what you want;
      $feesarr[] = array_merge($fetch, $new_arr); //creating array
    }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.