Why is my row count 0?


Posted on 16th Feb 2014 07:03 pm by admin

Here's the MySQL query i'm running. It basically pulls data from 2 tables based on some data passed.

Here are things i know.
1. The data passed is passed correctly, and is correct as far as data goes.
2. The sql statements do run, the database connection is solid and works.
3. Other queries work, this however is the first join query im attempting.
4. employee_directory is a regular table, but pcsmgr.mvx_phone_history_io is a table inside the pcsmgr SCHEMA on the database. hence the prefix in the table names.

My guess it that perhaps the fact that my SELECT fields have two periods? maybe i dunno.
pcsmgr.mvx_phone_history_io.extension for example.

Here's the query - please see if you can figure out why the $recordCount returns 0;
Code: <?php
#Check for this branch
$branchid_SQL = $brancharray[$key][0];
#===Find All People That Work for "filenumber" WITHIN EACH BRANCH
$sql_1 = "SELECT employee_directory.filenumber,
employee_directory.phone,
employee_directory.firstname,
employee_directory.lastname,
employee_directory.managerid,
employee_directory.departmentid,
employee_directory.branchid,
pcsmgr.mvx_phone_history_io.extension,
pcsmgr.mvx_phone_history_io.calldate,
pcsmgr.mvx_phone_history_io.calltype,
pcsmgr.mvx_phone_history_io.dur_seconds,
pcsmgr.mvx_phone_history_io.dur_minutes,
pcsmgr.mvx_phone_history_io.dist_pnums,
pcsmgr.mvx_phone_history_io.count_pnums,
pcsmgr.mvx_phone_history_io.dognet_user_id,
pcsmgr.mvx_phone_history_io.callcat
FROM pcsmgr.mvx_phone_history_io, employee_directory
WHERE employee_directory.managerid = '$DT_filenumber' AND
employee_directory.branchid = '$branchid_SQL' AND
employee_directory.filenumber = pcsmgr.mvx_phone_history_io.dognet_user_id";
$go_1 = oci_parse($conn, $sql_1);
oci_execute($go_1);
$result_1 = oci_fetch_assoc($go_1);
$recordCount = oci_num_rows($go_1);
echo $recordCount;
?>

-- NEW

just realised that by removing this line of code from the query
Code: <?php
AND employee_directory.filenumber = pcsmgr.mvx_phone_history_io.dognet_user_id
?>I actually get a result, an inaccurate one but a result none the less. So i guess the next question is whats wrong with that line?

68 Like 44 Dislike
Previous php-forum Next php-forum
Other php-forum

php mysql script to find record
Hi,

Currently I have a simple table with 4 columns. A, B, C, D

If I want to find all

Default TimeZone
The server I'm working with is hosted in America so all times inserted into the database are coming

Storing Values taken from a DB...
Using this code it will generate a short list from my database

<?php
mysql_connect

a multi dimensional array with for each
hi, I have been asked to write an array, I have Zone 2,3,4,5,6,7,8 each zone has 3 sections of weigh

Help building / using array
First - this is a cross-posting, if this is wrong I apologise! What started out as a MySQL query que

Custom CMS
This is a big custom CMS script I'd like to develop and would like some help atleast figuring out wh

Seperate team from score
I am writing a site that does a NFL Pick 'em type application and I have a feed that gives me the sc

Object Interfaces
EDIT: Never mind, I just updated to php 5.

Hey all,

I'm currently experimenting with p

Help please - How to validate from 2 possible answers
Hi

I hope somebody can help me with what will probably be really simple, I'm pulling my hair

form class help (oop php5)
Hidy Ho Neighbors,

I'm forcing myself to learn oop/classes for php5. It seems like a good id

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash