I have a PHP file that will run a SQL select statement and echo out the results. I am trying to be able to set individual columns to specific variables. Is this possible?
IE: based on the code below, how could I create a variable called $FirstName and set it equal to the value of the single record in the column firstname that is retued?
Thank you
$sql = "SELECT * FROM Employees where Employee_ID = 1";
$stmt = sqlsrv_query( $trpCo, $sql );
if( $stmt === false) {
die( print_r( sqlsrv_errors(), true) );
}
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
echo $row['FirstName'].", ".$row['LastName']."<br />";
}
