Hello friends!
1 - I will create a form to register .
2 - Each listing will have a number for reference.
3 - I create a custom field to go to the database , return the last number ,
concatenasse with the year plus an increment.
4 - Then record this information in the database and send email.
5 - I made the code to go to the bank and pick up this value and generate another .
How can I save this new record in the database ?
Can someone help me?
Some other solution to generate a serial number ?
Thank you all!
1 - I will create a form to register .
2 - Each listing will have a number for reference.
3 - I create a custom field to go to the database , return the last number ,
concatenasse with the year plus an increment.
4 - Then record this information in the database and send email.
5 - I made the code to go to the bank and pick up this value and generate another .
How can I save this new record in the database ?
Can someone help me?
Some other solution to generate a serial number ?
Thank you all!
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "sel";
// Cria Conexão
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Verifica Conexão
if (!$conn) {
die("Erro de Conexão: " . mysqli_connect_error());
}
//SQL dqa Consulta
$sql="SELECT max(mat) FROM matricula WHERE 1";
$resultado = mysqli_query($conn, $sql);
//Encontrou algo?
if(mysqli_num_rows($resultado) > 0){
while ($linha = mysqli_fetch_assoc($resultado)) {
echo "Última Matrícula: " . $linha["max(mat)"]. "<br>";
$ma = $linha["max(mat)"];
$ma++;
$mn = date("Y") .$ma;
echo "Nova Matrícula: " .$mn;
}
}
else {
echo "nenhum resultado";
}
mysqli_close($conn);
?>