-2
I’m creating a form counter and I’d like to know if I’m going the right way ?
This is my select query
<?php
error_reporting(-1);
ini_set('display_errors', 'On');
//Criar a conexao
$link = new mysqli ("localhost", "root", "", "peixaria");
if($link->connect_errno){
echo"Nossas falhas local experiência ..";
exit();
}
$sql= "SELECT MAX(m.id_pedido)
FROM mpedido as m WHERE id_pedido
ORDER BY m.id_pedido DESC
LIMIT 1";
$resultado_id= mysqli_query($link,$sql);
?>
and this is the php code that displays the id as counter . but type is giving an error
Notice: Array to string Conversion in C: xampp htdocs Requested projects.php on line 61
<span>Comanda:</span>
<?php
while($row = mysqli_fetch_array($resultado_id)){
echo '<span>'.["id_pedido"].'</span>';
}
?>
How could I make a counter from the id
It seems to me a duplicate of: http://answall.com/questions/178905/como-crea-um-campo-contador-em-php-a-partir-do-id-da-table
– MarceloBoni
'Cause no one could answer
– allan araujo
I feel that all your questions end up being poorly answered or else not even answered are... I suggest a read on the topic [Ask] and make a [tour]
– MarceloBoni
In fact as far as I can see, all your questions could fit the signage of "not clear enough"
– MarceloBoni
I know what it’s like .
– allan araujo
echo '<span>'.["id_pedido"].'</span>';
you’re making theid_pedido
in an array when placed between brackets. Use$row['id_pedido']
to display the ID.– Papa Charlie
Array to string Conversion means that you are having an array printed as if it were a string. When there is such an error, change the
echo
forprint_r
to 'debug' the error line.– Papa Charlie