V
V
vigayt2021-07-08 13:26:15
PHP
vigayt, 2021-07-08 13:26:15

How to output function value with query in MySQL in PHP?

How to output function value with MySQL query in PHP?
-------------------------------------------------- ---
Code itself:


function get_valplusid_all() 
{
    global $db;
    $singles = $db->query("SELECT MAX(id) + 1 FROM singles"); // Пагинация
    return $singles; 
}


How to output the received value to a normal input value?


<div class="col-12">
  <input type="number" class="form__input" name="idfilm" value="">
  </div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Otkidach, 2021-07-08
@Allegro75

If I correctly understood the meaning of the question (how to enter the value of a variable (for example, $var) in the html code above), then.
The file must be php (not html), and in it:

<div class="col-12">
  <input type="number" class="form__input" name="idfilm" value="<?=$var?>">
 </div>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question