Unable to retrieve data, mysql php pdo
Posted
by
Kyle Hudson
on Stack Overflow
See other posts from Stack Overflow
or by Kyle Hudson
Published on 2010-12-27T22:31:43Z
Indexed on
2010/12/27
22:54 UTC
Read the original article
Hit count: 160
Hi,
I have an issue, i cannot get any results from mysql on a production box but can on a development box, we use PHP 5.3 with MySQL (pdo).
$sd = $this->dbh->quote($sd);
$si_sql = "SELECT COUNT(*) FROM tbl_wl_data
WHERE (site_domain = $sd OR siteDomainMasked = $sd);";
if($this->dbh->query($si_sql)->rowCount() > 0) {
//gets to here, just doesnt get through the loop
$sql = "SELECT pk_aid, site_name, site_css, site_img_sw, supportPhone FROM tbl_wl_data
WHERE (site_domain = $sd OR siteDomainMasked = $sd);";
foreach($this->dbh->query($sql) as $wlsd) { //-- fails here
if($wlsd['wl_status'] != '1') {
require "_domainDisabled.php";
exit;
}
$this->pk_aid = $wlsd['pk_aid'];
$this->siteTitle = $wlsd['site_name'];
$this->siteCSS = $wlsd['site_css'];
$this->siteImage = $wlsd['site_img_sw'];
$this->siteSupportPhone = $wlsd['supportPhone'];
}
} else {
throw new ERR_SITE_NOT_LINKED;
}
It just doesnt seem to get into the loopk, i ran the query in navicat and it returns the data.
Really confused :S
© Stack Overflow or respective owner