Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3610948
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:48:57+00:00 2026-05-18T21:48:57+00:00

I have an issue, i cannot get any results from mysql on a production

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T21:48:57+00:00Added an answer on May 18, 2026 at 9:48 pm

    The following:

    $si_sql = "SELECT COUNT(*) FROM tbl_wl_data WHERE (site_domain = $sd OR siteDomainMasked = $sd);";
    if ($this->dbh->query($si_sql)->rowCount() > 0) ...
    

    Will always evaluate to TRUE even if the there are no content in your table. In fact, it will always return a single row named COUNT(*) that contains the number of rows matching your WHERE clause.

    You should scrap the first if and do that instead:

    $si_sql = "SELECT pk_aid, site_name, site_css, site_img_sw, supportPhone FROM tbl_wl_data WHERE (site_domain = $sd OR siteDomainMasked = $sd);";
    if ($this->dbh->query($si_sql)->rowCount() > 0) {
        // foreach here
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I already have this issue but I cannot remember how to solved it. (I
We have an issue using the PEAR libraries on Windows from PHP . Pear
I have a moderate understanding of how to use trap but cannot for the
I have an issue with IE6&7 that I cannot debug. I have a menu
I have a database issue that i currently cannot wrap my head around with
I have issue that is reproduced on g++. VC++ doesn't meet any problems. So
This seems like a very simple problem, but I cannot get a scrollbox to
EDIT: Mangling is fixed - primary issue appears to be the php/mysql connection In
I have couple of tables, where I cannot use hibernate mappings to define associations
Seems that lot of people already know that issue but I can not find

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.