SQL,PHP导出到CSV静态字段

I have created this php script to pull some data from my database and export it to CSV.

I've got headers set to 0,1,2,3,4,5 but I need some static text in columns 2, 3, 4 and 5.

Eg stock code, QTY, static, static, static, static.

The stock code, QTY are being pulled from the database.

Any help would be appreciated.

My code is below.

// open connection to mysql database
$connection = mysqli_connect($host, $username, $password, $dbname) or die("Connection Error " . mysqli_error($connection));

// fetch mysql table rows
$sql = "select ManufacturerPartNumber, (QuantityOnHand - QuantityOnSalesOrder) from iteminventory";
$result = mysqli_query($connection, $sql) or die("Selection Error " . mysqli_error($connection));

$fp = fopen('inventory.csv', 'w');

     fputcsv($fp, array('0', '1', '2', '3' '4' '5'));


while($row = mysqli_fetch_assoc($result))
{
     fputcsv($fp, $row);
}

fclose($fp);

//close the db connection
mysqli_close($connection);

I used this code other day to pull something into the first column.

    $id = 0; // or whatever else you want to have in the first column while($row = mysqli_fetch_assoc($result)) 
{ 
array_unshift($row, $id); 
fputcsv($fp, $row); 
$id; } 

You are fetching your results into an associative array which means the rows each look like: ['name1' => 'value1', 'name2' => 'value2']

First of all you should give your second value from the DB a name using something like AS Quantity in the select statement. Then you can either copy the values from the row into a new array any way you like or extend the row (which is an array) with the values you need. Since you are working index based in case of CSV I'd recommend creating a new array and filling it.

$csvrow = array();
$csvrow[0] = $row['ManufacturerPartNumber'];
$csvrow[1] = $row['Quantity'];
$csvrow[2] = $firstStaticThingy;
... and so on.
fputcsv($fp, $csvrow);