Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2010
    Thanked 0 Times in 0 Posts

    Please Please Help me with this sum function

    i want to get the sum of partysize printed but i get follow error

    Warning: mysql_fetch_array() expects parameter 1 to be resource, string given in C:\xampp\htdocs\ha\bestilling2.php on line 96

    Here is my code
    				$query = "SELECT Partysize, SUM( Partysize ) AS PartySizesum
    FROM booking
    WHERE BookDate = '2010-12-31'"; 
    				$row =mysql_fetch_array($query);
    				echo $row['PartySizesum'];
    Last edited by Binod Bista; 12-15-2010 at 06:02 PM.

  • #2
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Some say it's everything.
    Thanked 397 Times in 390 Posts
    It looks like you skipped a step. Try this:

    PHP Code:
    $query "SELECT Partysize, SUM( Partysize ) AS PartySizesum FROM booking WHERE BookDate = '2010-12-31'";

    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • Users who have thanked Rowsdower! for this post:

    Binod Bista (01-20-2011)


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts