1
How do I get a certain value from the SQL table after I have made a select. It will always return a single value
$sql = "SELECT MAX(cod_periodo) from periodo_edital";
$query = $this->db->query($sql);
$result = $query->result();
This is my code I need to access the cod_periodo field. Is there a specific command to execute?
Try to var_dump the variable
$result
, may be easier to solve– Leonardo Barros
It returns correct, but when I use $cod_periodo in my query it inserts as () and the error in the database
– Andre Lacomski
It seems that not coming the field you want, puts the query in the question, maybe the problem is there.
– Leonardo Barros
I changed it, but another problem came up. It returns an array as I do to take the string value it returned and switch to integer
– Andre Lacomski
You use PDO or mysqli?
– Leonardo Barros
To using PDO
– Andre Lacomski