Kod jest w klasie do obslugi danych, podam najwazniejsze czesci:
$this->db = new PDO('mysql:host='.$this->db_config['host'].';dbname='.$this->db_config['db_name'].';encoding=utf8', $this->db_config['username'], $this->db_config['password']);
$this->db->exec("SET CHARACTER SET utf8");
$this->db->exec("SET NAMES utf8");
$this->db->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING );
function fetch_results($results, $primary = '')
{
if ($results->rowCount() < 1)
while($dane_ = $results->fetch(PDO::FETCH_ASSOC)){
if ($primary != '')
$dane[$dane_[$primary]] = $dane_;
else{
$dane[] = $dane_;
}
}
return $dane;
}
$link = $this->fetch_results('select `link` from `'.$this->nazwa_bazy.'` where `id_produktu`="'.$id_produktu.'" limit 1', 'link');
Dane odebrane z bazy:
Kod
Array
(
[link] => http://www.tkqlhce.com/click-7954635-10940092?url=http://www.homebase.co.uk/en/homebaseuk/bracciano-modular-900-2-drawer-modular-unit-with-acrylic-basin---oak-with-handless-doors-126073
)
dane w bazie (prawidlowe):
Kod
http://www.kqzyfj.com/click-7954635-10940092?url=http%3A%2F%2Fwww.homebase.co.uk%2Fen%2Fhomebaseuk%2Fbracciano-modular-double-mirrored-wall-unit---oak-with-handless-doors-118428
Edit: dalem teraz:
Kod
$dane = $this->query('select `link` from `'.$this->nazwa_bazy.'` where `id_produktu`="'.$id_produktu.'" limit 1');
while($dane_ = $dane->fetch(PDO::FETCH_ASSOC)){
echo '<br/>dane: ';
print_r($dane_);
}
czyli pomijajac wszystko, samo pdo->query(); i mam taki sam wynik :/
ok problem byl jednak w innym miejscu, znalazlem go, dzieki