1
I have a table in the bank (use_shopBlock), which locks a button in the view, but when I give a <?php var_dump($shopBlock);?>
the result is NULL
.
My view:
<?php
$shopBlock = $this->main_model->configBlock('use_shopBlock');
if($shopBlock == 9){
echo '
<button type="button" id="open-shop" class="btn btn-primary"><i class="fa fa-shopping-cart" aria-hidden="true"></i>Abrir Minha Loja</button>
';
}
?>
My model:
public function configBlock($column = false) {
$this->db->limit(1);
if ($column) {
$this->db->select($column);
}
$query = $this->db->get('users');
$query = $query->result();
if ($query) {
if ($column) {
return $query[0]->$column;
} else {
return $query[0];
}
} else {
return false;
}
}
I will attach how my table was made in MYSQL
When the user registers, adds the value 8 in the shopBlock table, and the administrator, when changed to "Store Released", changes to the value 9.
This value 9, should release the button in the view.
Code that changes value in admin:
<div class="form-group">
<label>Ativar loja</label><br>
<select class="form-control" name="shopBlock">
<option <?=(($e && $item->use_shopBlock == '9') ? 'selected' : '')?> value="9">Loja Liberada</option>
<option <?=(($e && $item->use_shopBlock == '8') ? 'selected' : '')?> value="8">Loja Bloqueada</option>
</select>
</div
Where is the post code for tbl change?
– Ronald Araújo
You refer to the code that changes the value from 8 to 9 and vice versa? is there, but the problem is not that. The problem that is not getting the value in the table.
– wiliamvj
I think the function
result( )
of the Codeigniter is returningnull
, and therefore running the linereturn false;
because probably the table is empty.– C. Bohok