Go Back   Rhinocerus > Newsgroup > Newsgroup comp.databases.mysql

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 06-09-2008, 08:33 PM
Mo
Guest
 
Posts: n/a
Default Novice getting ERRORS.

I am trying to build a Employee Order Detail report.
My first hurdle is as follows.

The SO info I am getting isn't listed under the correct user.
It belongs to the user matching the pre-assigned $eID (employee
number) value, not the $eID of the current pointer.
If I DON'T pre-assign a value, I get these ERRORS (which repeat for
each user name):
********
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL
result resource in /home/voyager1/public_html/turbine/moTest.php on
line 46

Warning: current() [function.current]: Passed variable is not an array
or object in /home/voyager1/public_html/turbine/moTest.php on line 52

********
MY CODE:
********
<?PHP
$host = "xxx";
$uid = "xxx";
$pw = "xxx";
$db = "xxx";

$moCon = MySQL_connect($host,$uid,$pw);
MySQL_select_db($db,$moCon);


// temp for test purposes
$eID = 15;

// WHERE statements
//$empWhere = "WHERE";
$agrWhere = "WHERE i.shipDate='2008-05-21' AND i.employeeID=$eID";
$dtlWhere = "WHERE sl.consignmentCode='B-001'";


// Queries
$empQry = "SELECT employeeID, signature FROM Employee";

$agrQry = "SELECT i.shipDate, i.salesOrderID, i.invoiceID, c.name,
c.oemFlag
FROM Invoice as i
LEFT JOIN SalesOrder as so USING (salesOrderID)
LEFT JOIN Company as c ON so.companyID=c.companyID
$agrWhere";

$dtlQry = "SELECT r.soItemID, r.stockID, sl.consignmentCode,
r.shipped, SOi.unitAmount, sl.unitCost, cc.codeCommRate
FROM Reserve as r
LEFT JOIN Stockline as sl USING (stockID)
LEFT JOIN SOItem as SOi USING (salesOrderID,soItemID)
LEFT JOIN ConsignmentCodes as cc ON
sl.consignmentCode=cc.ConsignmentCode
$dtlWhere";


// Query results
$empResult = MySQL_query($empQry,$moCon);
$agrResult = MySQL_query($agrQry,$moCon);
$dtlResult = MySQL_query($dtlQry,$moCon);


// Result arrays
$empArray = MySQL_fetch_array($empResult, MYSQL_NUM);
$agrArray = MySQL_fetch_assoc($agrResult);
$dtlArray = MySQL_fetch_assoc($dtlResult);


while ($empRow = MySQL_fetch_assoc($empResult))
{
$eID = current($agrArray);
echo $empRow["employeeID"] . ") " . $empRow["signature"] . "<br/>";
while ($agrRow = MySQL_fetch_assoc($agrResult))
{
echo $agrRow["salesOrderID"] . "/" . $agrRow["invoiceID"] . "<br/>";
}
$eID++ ;
}

print('<pre>');
print_r($empArray);
print('</pre>');


print('<pre>');
print_r($agrArray);
print('</pre>');


print('<pre>');
print_r($dtlArray);
print('</pre>');
?>
********

THE DESIRED END RESULTS:
We want a report which gives the following info:
-User
-----SO/Invc info
------------SO/Invc Item info
------------SO/Invc Item info
-----SO/Invc info
------------SO/Invc Item info
------------SO/Invc Item info
-User
-----SO/Invc info
------------SO/Invc Item info
------------...etc...

For the time being, I am focusing on getting just the first 2 layers
(names and orders) to behave properly, then I'll add in the Item level
details.

The mysql_fetch_assoc() errors lead me to post to this group.
If this turns out that this question could be better served via the
PHP group, please advise.
TIA,
~Mo
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 06-09-2008, 09:41 PM
Dan Rumney
Guest
 
Posts: n/a
Default Re: Novice getting ERRORS.

Mo wrote:
[snip]

> The mysql_fetch_assoc() errors lead me to post to this group.
> If this turns out that this question could be better served via the
> PHP group, please advise.


You might get some help here, but this newsgroup is for MySQL Database
and not PHP.

Without knowing what the PHP/MySQL library is sending to the MySQL
database, it's hard to know if the problem is with the MySQL usage or
the PHP usage.

If you set up your DB to log all queries and watch that log as you
execute your PHP script, it may give some pointers to resolve your problem.
Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Trapping errors Raynaud, Scott Newsgroup comp.soft-sys.sas 0 06-13-2008 10:52 PM
Trapping errors Talbot Michael Katz Newsgroup comp.soft-sys.sas 0 06-13-2008 08:09 PM
Re: Roger's clustered errors versus dummies Marina Kekrou Newsgroup comp.soft-sys.sas 0 05-29-2007 06:58 PM
Re: Clustered Standard Errors Ban Cheah Newsgroup comp.soft-sys.sas 0 06-14-2006 07:06 PM
Re: PROC GLIMMIX and Unable to restore errors! David L. Cassell Newsgroup comp.soft-sys.sas 0 06-15-2005 04:55 PM



All times are GMT. The time now is 04:31 AM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.