Working with WordPress, running a custom query to pull all records relating to a specific condition. When I run the query in phpmyadmin it returns all records, when I run the query through PHP code, only 2-5 results return, need to find out how to resolve this:
// get variables from form page
$txtReg = $_REQUEST['txtReg'];
$txtMsg = $_REQUEST['txtMsg'];
// connect to database
$mydb = new
wpdb('***','***','***','***');
// run the query to fetch all cell numbers from the region variable
$query = "SELECT * FROM tblusers WHERE `Region` ='$txtReg'";
$rows = $mydb->get_results($query);
// display all cell numbers from that region
foreach ($rows as $row) {
$txtCell = $row->Cell;
//doSendSMS($txtCell,$txtMsg);
echo $txtCell;
}
E.g there are 100 cell numbers in Region A, only a few are returned and echoed, not all 100 like it should be, so when I run the sms code (which is the actual function, echo is used just to test results), not all receive the sms.