10-10-2016, 01:15 PM
Whenever you're passing a variable into a raw sql query, you should bind your variable. Also, if you're using the header from userspice on your page, you don't have to do the DB::getInstance because the header instantiates the db for you.
Ok. So here is how I would write that....
$customiseQ = $db->query(“SELECT * FROM customise-distributor WHERE distributor = ?",array($parts[4]); //bind your variable.
Personally, when I'm trying to echo that stuff out, I close php and go back to html...
So I would do
Header Colour:<?=$customise->header_colour?>
I hope that helps. You can also do
dump($customize);
to see everything your query brought back to make sure there isn't a misspelling or something.
Ok. So here is how I would write that....
$customiseQ = $db->query(“SELECT * FROM customise-distributor WHERE distributor = ?",array($parts[4]); //bind your variable.
Personally, when I'm trying to echo that stuff out, I close php and go back to html...
So I would do
Header Colour:<?=$customise->header_colour?>
I hope that helps. You can also do
dump($customize);
to see everything your query brought back to make sure there isn't a misspelling or something.