I have a table called "Current state", it has three columns known as:
id name state
1 FXD 1
2 GFX 3
3 ATOM 2
4 FARB 3
5 REX 1
6 FRX 2
In the following code I get it into array and print it:
$exc = $conn->prepare("SELECT name,state from current_state");
$exc->execute();
while($finalResult = $exc->fetch(PDO::FETCH_ASSOC))
{
$tables[] = $finalResult;
}
var_dump($tables);
But the problem is though numbers represent the state column values each of those numbers have a meaning:
1 = running
2 = finished
3 = dimnished
So what I want is to add the above string values right away to the tables array by comparing the values of the state column.
The current print result of a column would look like
array (size=2)
'name' => string 'FRX' (length=11)
'state' => string '2' (length=1)
But what I want is:
array (size=2)
'name' => string 'FRX' (length=11)
'state' => string 'finished' (length=8)