Engage in PHP-based word processing
P粉590929392
2023-09-02 22:45:43
<p>I have retrieved data from an MSSQL server table.
Thanks to the query I am able to display them.
I want to be able to modify this data without touching the table</p>
<p>For example, a value of 1 for enc_paye would display ("Order in preparation") and enc_prepared (Order ready)</p>
<p>I would also like to know if it is possible to delete the text from the table and recover only the data. </p>
<pre class="brush:php;toolbar:false;"><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Espace Client</title>
</head>
<body>
<center><div class="Informations">
<?php
//CONNEXION ODBC SERVER//
$dsn="";
$user="";
$password="";
$conn=odbc_connect($dsn,$user, $password);
//REQUETES
$sql = <<<EOF
SELECT top 10 [enc_cmd_num], [enc_paye], enc_prepared, enc_emporte, enc_heure_fab_fin, enc_ext_ref
FROM [encaissement]
WHERE enc_date= '20221130'
EOF;
$results = odbc_exec($conn,$sql);
odbc_result_all($results);
//CONDITION
echo "<table>";
while($resultrow = odbc_fetch_array($results)) {
switch($resultrow['enc_paye']){
case 0:
echo "Commande en attente paiement";
break;
case 1:
echo "Commande en cours de préparation";
break;
default: echo "<td>Unknown</td>";
}
}
echo "</table>";
?>
</div></center></pre>
You can get the ODBC results as an array:
It seems that you may be storing status information about the order in different columns. I recommend just using one column with different status numbers.
Maybe:
You can then use a switch statement in PHP to choose between text options
For example:
odbc_result_all
function is deprecated, so ideally you should not use it.** Edited the following comment by @Adyson **