S
S
santavits2018-06-24 00:13:50
PHP
santavits, 2018-06-24 00:13:50

How to update value in mysql selected in select?

There is a table on the site whose rows are displayed with mysql
Here is the output code + tables

<table class="table-striped" border="1" style="font-size:13px;width: 100%;max-width: 100%;text-align:center;border: 1px solid #d9d9d9;">
          <thead>
            <tr>
      <th>ID</th>
      <th>Пользователь</th>
              <th>Дата</th>
              <th>Тип</th>
        <th>Кошелёк</th>
        <th>Сумма</th>
        <th>Статус</th>
            </tr>
          </thead>
          <tbody>
<?  $results = mysql_query("SELECT * FROM `pay` WHERE 1 ORDER BY status='Готово'", $db);
while ($rows = mysql_fetch_array($results)) {
$vid = $rows["id"];	
$vuser = $rows["user"];	
$vdata = $rows["data"];
$vpayment = $rows["payment"];
$vcosh = $rows["cosh"];
$vsumma = $rows["summa"];
$vstatus = $rows["status"];

?>
          <tr>
      <th scope="row"><?php echo $vid;  ?></th>
          <th scope="row"><?php echo $vuser;  ?></th>
      <th scope="row"><?php echo $vdata;  ?></th>
          <td><? echo $vpayment; ?></td>
      <td><? echo $vcosh; ?></td>
      <td><? echo $vsumma; ?></td>
      <td>
      <select name="status">
         <option disabled selected ><? echo $vstatus; ?></option>
          <option value="Ожидание">Ожидание</option>
          <option value="Готово">Готово</option>
           </select>
</td>
</tr>  
      	<?}?>		  
 </tbody>
</table>

VIM0qkYq.png
In the last column there is a status with an option, the selected value from there should be updated in the database,
i.e. for example, in a certain row I selected the value Done
, then this value should also be updated in the mysql table, tell me how to do it easier.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nozzy, 2018-06-24
@santavits

ajax

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question