mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
Use sprintf() instead of long concatenation
This commit is contained in:
+8
-4
@@ -145,10 +145,14 @@ while ($row = sqlsrv_fetch_array($getProducts, SQLSRV_FETCH_ASSOC)) {
|
||||
break;
|
||||
}
|
||||
$ctr++;
|
||||
echo $row['SalesOrderID'] . str_repeat(' ', 13) . $row['CustomerID'] . str_repeat(
|
||||
' ',
|
||||
11
|
||||
) . $row['TotalItems'];
|
||||
echo sprintf(
|
||||
'%s%s%s%s%s',
|
||||
$row['SalesOrderID'],
|
||||
str_repeat(' ', 13),
|
||||
$row['CustomerID'],
|
||||
str_repeat(' ', 11),
|
||||
$row['TotalItems']
|
||||
);
|
||||
echo('<br/>');
|
||||
$productCount++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user