Skip to main content
Fixed grammar. corrected spelling.
Source Link
Muhammad Reda
  • 27.1k
  • 14
  • 100
  • 107

want How to store one or more column with mysql data in an array

The output that iI get

Name    Age
ABC     12
PQR     40
XYZ     10

code for retriveretrieving data from mysqlMySql database using PHP.

  //Get records from database
  $result = mysql_query("SELECT * FROM people;");
            
    //Add all records to an array
    $rows = array();
    $count = 0;
    while($row = mysql_fetch_array($result))
    {
     // Here i want to bind one more colomn for count as Row number to array
        count = count + 1;
        $rows[] = $row;
    }

desired output..

RowNo    Name    Age
 1       ABC     12
 2       PQR     40
 3       XYZ     10

iI want to send count number with mysql data as one colomn. canCan anybody guide me to on that..?

want to store one more column with mysql data in array

output that i get

Name    Age
ABC     12
PQR     40
XYZ     10

code for retrive data from mysql database using PHP.

  //Get records from database
  $result = mysql_query("SELECT * FROM people;");
            
    //Add all records to an array
    $rows = array();
    $count = 0;
    while($row = mysql_fetch_array($result))
    {
     // Here i want to bind one more colomn for count as Row number to array
        count = count + 1;
        $rows[] = $row;
    }

desired output..

RowNo    Name    Age
 1       ABC     12
 2       PQR     40
 3       XYZ     10

i want to send count number with mysql data as one colomn. can anybody guide me to on that..

How to store one or more column with mysql data in an array

The output I get

Name    Age
ABC     12
PQR     40
XYZ     10

code for retrieving data from MySql database using PHP.

  //Get records from database
  $result = mysql_query("SELECT * FROM people;");
            
    //Add all records to an array
    $rows = array();
    $count = 0;
    while($row = mysql_fetch_array($result))
    {
     // Here i want to bind one more colomn for count as Row number to array
        count = count + 1;
        $rows[] = $row;
    }

desired output..

RowNo    Name    Age
 1       ABC     12
 2       PQR     40
 3       XYZ     10

I want to send count number with mysql data as one colomn. Can anybody guide me to on that?

Source Link
Vijay
  • 8.5k
  • 11
  • 47
  • 70

want to store one more column with mysql data in array

output that i get

Name    Age
ABC     12
PQR     40
XYZ     10

code for retrive data from mysql database using PHP.

  //Get records from database
  $result = mysql_query("SELECT * FROM people;");
            
    //Add all records to an array
    $rows = array();
    $count = 0;
    while($row = mysql_fetch_array($result))
    {
     // Here i want to bind one more colomn for count as Row number to array
        count = count + 1;
        $rows[] = $row;
    }

desired output..

RowNo    Name    Age
 1       ABC     12
 2       PQR     40
 3       XYZ     10

i want to send count number with mysql data as one colomn. can anybody guide me to on that..