Hello, I have the following function to read DB data mysql.
Here I call - >
$clientes = DBRead('clientes', null, 'nome, telefone1');
Here I display - >
echo $nam = json_encode($clientes);
Result:
[
{
"nome":"Davi",...
How to update multiple records by setting different values, eg:
$update = "UPDATE tabela SET ativo=1, nivel=2 WHERE nome ='jose'
AND nome='maria'
AND n...
I would like to know if you have a way to sum the value of a line with itself without having to query after an update.
I have a column called total that holds integers, at some point I want the value that is on this line to be s...
I need to make an query where I only display results in one condition:
# Search the Database
$select_sql = "SELECT * FROM users WHERE user LIKE :search OR date_access LIKE :search OR ip LIKE :search AND active LIKE :active ORDER BY id DESC";
$...
I need to compare date at a certain time interval. I need to get the DAT_REPOT_REALZ field and check the dates between TODAY and seven days ago. I also need to count the number of V (visitor) and the number of L (leader) and M (participan...
Can anyone explain why when I run this code it INSERT twice the same value in the table?
I believe that this problem happens when I do a validation to verify that the values have been entered: if(!$lc_follow_dados->execute())...
I have a very simple system of Registration and Login, I have done a validation in both fields.
I want to adapt this validation to something more specific like:
Login does not exist
Invalid password
Currently my validation has a sing...
I have the following scene:
$consulta = Dealer::find(1);
No Model
# Serviços
public function dealer_servicos(){
return $this->hasMany('App\DealerService', 'id_concessionaria');
}
Then if I do:
@foreach($consulta->dealer...
I have a table in a MySQL bd that has 5 fields.
This would be a template query:
select * from myTable where campo1= 4 and campo2=1 and campo3 =7.
However, field3 may have null value and I would need to select or exclude combinations that in...
I have a database with the tables estabelecimentos and produtos . Register the products relating to the establishments.
I need to make an appointment where I only select one product from each establishment, I thought about doing...