-2
Hello folks I am creating a class for user data and would like to know how to insert a sternal variable containing data, for example from the database:
class Usuario {
public $nomecompleto;
}
$DadosUsuaio = new Usuario;
$DadosUsuaio->nomecompleto = $nome_completo;
For example this variable $full name_name, my case name when I var_dump, gives error .
could help me?
The syntax seems to be correct. Why not edit the question and add the error message and the complete code?
– Woss
Notice: Undefined variable: nome_completo in (camiododiretorio)
– Malone Castro
Full code now...
– Woss
Actually it is just a test, this variable $full name assign my name on it test "Malone Castro" and gave var_dump and gave error
– Malone Castro
Even if it is a test, the code needs to be complete. If you have not set the variable, it will obviously result in this error.
– Woss
If I will use for various users I can not assign a value only right friend? rs
– Malone Castro
the variable set within the class? would this be?
– Malone Castro
and how to do this using PDO
– Malone Castro
If you are going to assign several, it depends on how this data will arrive. How is the database? How do you recover this data? How are you iterating on them? If you don’t ask a clear question, you can’t get a clear answer.
– Woss
Data recovers via SELECT in DB using PDO class
– Malone Castro