1
I’m developing a surf site. In it, there’s a section called My Ideal Surfboard.
Where the user will enter their data (Nome
, email
, peso
, altura
and experiencia
(beginner, intermediate or advanced)).
I will save this data in the bank and based on user characteristics (weight, height and experience) I will say the ideal board type.
The section is already done and is also already recording the user data in the database. I received a table/reference list with all the board measurements according to the height and weight of the user.
To return the ideal board, I need to take user data and compare with this table.
I thought I’d do it this way,
I divided into three tables/sections: Experiencia
, Peso e Altura
and Modelo de prancha
.
Each table/section I will assign an ID to:
User experience -> ID a,b,c
Weight and Height -> ID a,b,c,d....
Board Model -> ID a,b,c,d....
Table with user experience, one ID for each.
Table with the Weight and Height ratio of the user, an ID for each.
Final table with the board models an ID for each.
To get the result I will somehow compare the table Experiencia
with the table Peso+Altura
, generating an ID or X number that will be compared with the ID of the third table (with the Board models) and thus obtaining the result. I do not know if it was very clear the explanation, anything can ask me.
My question is: Is that my logic? Is this the best way to do it? In code, how can I do that?
Any kind of help is welcome!
So far I only have the code that registers the data in the database:
--I don’t think the form’s HTML is very useful. If requested, I post it here or in Pastebin.
function cadastrar($nome,$email,$estilo,$experiencia,$altura,$peso){ //INSERE OS DADOS NO BANCO
global $wpdb;
// Minha tabela
$table = 'aa_minhaprancha';
// Inserindo os dados no array "data", responsável pelos dados a serem gravados no banco
$data = array(
'nome' => $nome,
'email' => $email,
'estilo' => $estilo,
'experiencia' => $experiencia,
'altura' => $altura,
'peso' => $peso,
);
// run the insert
$updated = $wpdb->insert( $table, $data );
// Se não ocorrer o update, retorna o erro
if ( ! $updated ) {
$wpbb->print_error();
}
}
The bank is in Wordpress. However, there is no problem if there is some help in Mysql. I convert.
Recapping:
What I want to do? - Display the ideal board model according to the user’s profile.
As I want/am doing? - Taking user data (Level of experience, Height, Weight and Type of board), comparing them with mine lista de referência
and displaying to the user.
How can I do that?
Zkk, served my friend tip?
– Leo
And ai Zkk... served?
– Leo