Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
  1. #1
    Senior Member shoffman3572's Avatar
    Join Date
    Jul 2008
    Location
    Fullerton, CA
    Posts
    137
    Member #
    16990
    Here's my code: The query runs without any errors - all the variables - $customer, $startDate, $endDate have valid values.

    $customer = 772530; // just set this for testing.. I know I get results from this customer number.

    $dateHandle = mysql_query("select A.DateEntered from Order_Header as A, Order_Detail as B where A.CustomerNumber=".$customer." and A.OrderNumber = B.OrderNumber and (A.DateEntered > '$startDate' and A.DateEntered < '$endDate') group by A.DateEntered");

    $count = mysql_num_rows($dateHandle);

    while ($row = mysql_fetch_array($dateHandle));
    {
    echo $row[0] . " - " .$count;
    }

    when I run this - $count - the number of rows returned = 3.. But that while loop only fires once and does not return a value for $row[0] at all..

    Any ideas because I'm stuck.

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,717
    Member #
    5580
    Liked
    718 times
    echo $row['DateEntered'] . " - " .$count;

    or A.DateEntered ... if A. is part of your column name.


  4. #3
    Senior Member shoffman3572's Avatar
    Join Date
    Jul 2008
    Location
    Fullerton, CA
    Posts
    137
    Member #
    16990
    thanks. I tried that. At this point I think it's something to do with our server because I set up a very simple test page with a very basic query and that's not working properly either.. In my test I also assign $row = mysql_fetch_row($dateHandle); and echo $row[0]; works just fine...?

    it's probably something to do with the code connecting to the DB - but I have other pages on the site using the exact same connection code and they work just fine.. I'm just thankful it's Friday and a beer is about 2 hours away! ;-)

  5. #4
    Senior Member shoffman3572's Avatar
    Join Date
    Jul 2008
    Location
    Fullerton, CA
    Posts
    137
    Member #
    16990
    ok - I found the problem a few days ago - and it's sooo annoying that such a small mistake can cause so much trouble - but here's why this didn't work, nor show any kind of error message.

    while ($row = mysql_fetch_array($dateHandle));

    that semicolon at the end of that line.. I don't even know why I put it there - I don't usually. But that tiny byte of data cause the whole thing to fail...

  6. #5
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,717
    Member #
    5580
    Liked
    718 times
    It's always the smallest things ... oh well


  7. #6
    Junior Member
    Join Date
    Apr 2012
    Posts
    12
    Member #
    31568
    FYI.. you don't need to do ".$customer." you can just do $customer


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:36 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com