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);
?>
Hello eduardo-rs,
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
How can I automatically copy fields from one part of my form to another?
P.S: I'm just an automated service😉
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
How can I automatically copy fields from one part of my form to another?
P.S: I'm just an automated service😉
Hi eduardo-rs,
First - does this have to be a serial number? It can be simpler and more secure to use a random string (I have a beta version of an action that will do that).
If it does need to be serial then I would probably use a DB Save to save the form results - the new record ID will then be available in the $form->data['array'], you can use a Custom Code action to process that to create your new serial number and then update the record using the ID to identify it.
Bob
First - does this have to be a serial number? It can be simpler and more secure to use a random string (I have a beta version of an action that will do that).
If it does need to be serial then I would probably use a DB Save to save the form results - the new record ID will then be available in the $form->data['array'], you can use a Custom Code action to process that to create your new serial number and then update the record using the ID to identify it.
Bob
Hello , thank you for answers .
GreyHead , it is just a sequential number that will serve as registration .
I'm using a ChronoForms database and created a field to save this number.
All I need is to show this variable in a "TEXT BOX " or "FILE FIELD " .
This I do not know how to do.
Could you give me an example?
Thank you.
GreyHead , it is just a sequential number that will serve as registration .
I'm using a ChronoForms database and created a field to save this number.
All I need is to show this variable in a "TEXT BOX " or "FILE FIELD " .
This I do not know how to do.
Could you give me an example?
Thank you.
Array
(
[option] => com_chronoforms5
[chronoform] => teste
[event] => submit
[matr] => Here I put the coming of my PHP code variable !!!!!
[nome] => rtgsgt
[cpf] => grs
[email] => rggrtg@geg.com
[tel1] => (53) 3453-453_
[termos] => 1
[button3] => Matricular
)
(
[option] => com_chronoforms5
[chronoform] => teste
[event] => submit
[matr] => Here I put the coming of my PHP code variable !!!!!
[nome] => rtgsgt
[cpf] => grs
[email] => rggrtg@geg.com
[tel1] => (53) 3453-453_
[termos] => 1
[button3] => Matricular
)
Or can I use a function like this :
How do I put this function in a textbox ?
<?php
echo "DC " .date("ymj.his");
?>
How do I put this function in a textbox ?
I did it!
Any suggestions to improve this code ?
Any suggestions to improve this code ?
<?php
$novaMat = "DC " .date("ymj.his");
echo $novaMat;
$form->data["matr"] = $novaMat;
?>
Well, I finished with the code
if anyone needs....
thank you!
if anyone needs....
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "mydb";
// 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(id) FROM doctor_chronoengine_chronoforms_datatable_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(id)"]. "<br>";
$ma = $linha["max(id)"];
$ma++;
$mn = "DC".date("ymj.") .$ma;
//echo "Nova Matrícula: " .$mn;
$form->data["matr"] = $mn;
}
}
else {
echo "nenhum resultado";
}
mysqli_close($conn);
?>
thank you!
This topic is locked and no more replies can be posted.
