sql - Assign values from an array to specific PHP variables -


i trying use php select values sql server db , assign values specific parameters.

the table selecting looks this:

**columnname1 columnname2** datarow1col1, datarow1col2 datarow2col1, datarow2col2 datarow3col1, datarow3col2 datarow4col1, datarow4col2 

i trying create variable equal datarow3col2 has columnname1 = datarow3col1.

is possible?

here have far:

  $sql = "select * table id = {$id}";   $stmt = sqlsrv_query( $trpconn, $sql );   if( $stmt === false) {     die( print_r( sqlsrv_errors(), true) );   }    $data = array();    while( $row = sqlsrv_fetch_array( $stmt, sqlsrv_fetch_assoc) ) {      $data[] = $row;    }     sqlsrv_free_stmt( $stmt);  

thank you

$sql = "select * table id = {$id}";   $stmt = sqlsrv_query( $trpconn, $sql );   if( $stmt === false) {     die( print_r( sqlsrv_errors(), true) );   }    $data = array();    while( $row = sqlsrv_fetch_array( $stmt, sqlsrv_fetch_assoc) ) {      $data[$row['columnname1']] = $row['columnname2'];    }    sqlsrv_free_stmt( $stmt);    extract($data);    echo $datarow1col1;   // output is: datarow1col2 

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -