0
I didn’t mean that
Returns
SELECT * FROM tbl_temporadas WHERE serie_id = '2' AND serie_slug = 'dois-homens-e-meio' AND temp_audio = 'l'
Does not return
SELECT * FROM tbl_temporadas WHERE serie_id = '2' AND serie_slug = 'dois-homens-e-meio' AND temp_audio = 'd'
My table
CRUD
private $query;
private function prep_exec($prep, $exec) {
$this->query = $this->get_con()->prepare($prep);
$this->query->execute($exec);
}
public function select($fields, $table, $prep, $exec) {
$this->prep_exec("SELECT ".$fields." FROM ".$table." ".$prep."", $exec);
return $this->query;
}
$open_serie = $ctlr->select("*", "tbl_seriados", "WHERE serie_slug = ?", array($sep[0]));
foreach ($open_serie as $list) :
$serie_id = (int)$list['serie_id'];
$open_temp_dub = $ctlr->select("*", "tbl_temporadas", "WHERE serie_id = ? AND serie_slug = ? AND temp_audio = ?", array($serie_id, 'dois-homens-e-meio', 'D'));
endforeach;
Try to repair your database.
– anonimo
try to make the id whole by removing the quotation marks of the number 2 SELECT * FROM tbl_temporadas WHERE serie_id = 2 AND serie_slug = 'two-men-and-a-half' AND temp_audio = 'l'
– Anderson Henrique
@Anonimo It wasn’t, strange
– goio
@Andersonhenrique In my code I already define the id int
$serie_id = (int)$list['serie_id'];
still won’t– goio
Put your php code too
– Anderson Henrique
There is a chance to have a blank space before the’d'?
– Ronaldo Araújo Alves
@goio: what do you mean by "It wasn’t" when trying to repair the database?
– anonimo
Truth may be what @Ronaldoaraújoalves said, in this case to test, run this query SELECT * FROM tbl_temporadas WHERE serie_id = '2' AND serie_slug = 'two-men-and-a-half' AND temp_audio LIKE '%d%'
– Anderson Henrique
If return is because there is space between the d
– Anderson Henrique
@anonimo Remains the same http://prntscr.com/nyyr75
– goio
@Anderson Henrique http://prntscr.com/nyysvg. Ronaldo has no whitespace
– goio
try the quotes again at number 2 using like, because your first query that worked you used quotes
– Anderson Henrique
@Andersonhenrique Even if you select only the id after the Slug together it only pulls the first 3 http://prntscr.com/nyyvbi http://prntscr.com/nyyvom
– goio
Let’s go continue this discussion in chat.
– Anderson Henrique
If the class
$ctrl
do not have a debug method to print which query is being formatted, I would put aecho $sql; exit;
somewhere inside$ctrl->select
to see which query is being formed.. may sometimes be formatting incorrectly.– Vinicius.Silva