I'm developing a surf site. In it, there is a section called My Ideal Board.
Where the user will enter his data ( Nome
, email
, peso
, altura
and experiencia
(beginner, intermediate or advanced)).
I will save this data in the database and based on user characteristics (weight, height and experience) I will say the ideal board type.
The section is already done and you are already saving the user data in the database. I received a table / reference list with all board measurements according to the height and weight of the user.
Toreturntotheidealboard,Ineedtogettheuserdataandcompareitwiththistable.
Ithoughtaboutdoingthisasfollows,
Idividedintothreetables/sections:Experiencia
,PesoeAltura
andModelodeprancha
.
Eachtable/sectionIwillassignanID:
Userexperience->IDa,b,c
Weight&Height->IDa,b,c,d....
BoardModel->IDa,b,c,d....
Tablewiththeuserexperience,anIDforeach.
TablewiththeUserWeightandHeightratio,anIDforeach.
Final table with templates plank an ID for each.
Experiencia
table with the Peso+Altura
table, generating an ID or X number that will be compared to the ID of the third table (with the Table templates) and thus obtaining the result. I do not know if the explanation was very clear, anything you can ask me.
My question is: Is this correct for me? Is this the best way to do it? In code, how can I do this?
Any kind of help is welcome!
So far I only have the code that registers the data in the database:
--I do not think the HTML of the form is very useful. If you request, I post here or 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 on Wordpress. However, there are no problems if there is any help in MySql. I convert.
Recapping:
What do I want to do? - Show the user the ideal board template according to his profile.
How do I want / am doing? - Taking user data (Experience Level, Height, Weight and Board Type) by comparing them with my lista de referência
and displaying to the user .
How can I do this?