PHP returning less results than phpmyadmin even though the query is the same
When I run the following query in phpmyadmin, I get back 18 results – all of which are correct and what I’m looking for. However, when I copy & paste the query into a php file and run the page, I get back 17 results.
SELECT
ta.jobTaskID,
jt.customTaskTitle, jt.taskID, jt.status,
d.dealershipName,
j.jobNumber, j.jobID, j.title, j.jobSpec,
wt.taskName,
po.dueToProduction
FROM taskassignments ta
INNER JOIN jobTasks jt ON ta.jobTaskID = jt.jobTaskID
INNER JOIN jobs j ON jt.jobID = j.jobID
INNER JOIN dealerships d ON j.dealershipID = d.dealershipID
LEFT JOIN workflowtasks wt ON jt.taskID = wt.taskID
LEFT JOIN purchaseorders po ON j.jobID = po.jobID
WHERE ta.userID = 1 AND jt.status != 'Completed';
EDIT:
Here’s a snapshot of my phpmyadmin result:

and here’s a snapshot of my var_dump:

Here’s my PHP code (I use a DB class I created)
$myTasks = $connection->runQuery("
SELECT
ta.jobTaskID,
jt.customTaskTitle, jt.taskID, jt.status,
d.dealershipName,
j.jobNumber, j.jobID, j.title, j.jobSpec,
wt.taskName,
po.dueToProduction
FROM taskassignments ta
INNER JOIN jobTasks jt ON ta.jobTaskID = jt.jobTaskID
INNER JOIN jobs j ON jt.jobID = j.jobID
INNER JOIN dealerships d ON j.dealershipID = d.dealershipID
LEFT JOIN workflowtasks wt ON jt.taskID = wt.taskID
LEFT JOIN purchaseorders po ON j.jobID = po.jobID
WHERE ta.userID = " . $userID . " AND jt.status != 'Completed'");
Finally, here’s the code the connection class uses to run a query:
// runs the user defined query
public function runQuery($runMe)
{
$outArray = array();
if ($this->checkConnection()) // if the connection is a resource
{
$returned = mysql_query($runMe, $this->dbConnection);
if ($returned === false) // if there was an error during sql execution
{
echo "SQL Query error: " . mysql_error();
}
if ($returned === true) // if a update, insert, delete, etc... command was run
return true;
if (is_resource($returned))
{
$outArray = array(); // returned array with query results
for ($i = 0; $i < mysql_num_rows($returned); $i++)
{
$outArray[] = mysql_fetch_assoc($returned);
}
}
if (count($outArray) < 1)
return null;
else
return $outArray;
}
else
echo "Your Database Connection Was Unable To Be Authenticated.";
}
Total Views: 11 Today Views: 0















