SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    858
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Shouldn't be getting, "Query was empty"

    I'm having having a hard time figuring out why I'm getting "Query was empty". When I run my query. To help debug I print the query that is being executed on the webpage. The strange this is, I can copy that query, paste into phpMyAdmin and it runs without getting, "Query was empty".

    Can I not run a query like this in a WHILE loop? Thanks in advance!!


    Code:
    ////////////////////////////////////////////////////////////////////
    //If we just printed a label for an information kit
    ////////////////////////////////////////////////////////////////////
    
    if ($kind == "kit") {
    
    $contactIDs = implode ($selections, ", ");
    
    $details = "A product information kit was assembled today and will be mailed shortly.";
    
    $updateContact = "UPDATE contacts SET needsKit = 'No', modified = '$modified' where contactID in ($contactIDs) and ownerID = '$session_ownerID'";
    
    echo $updateContact;
    
    //mysql_query($updateContact) OR die(mysql_error());
    
    $selectionCount = count($selections);
    
    print ("<p>Contacts in array = $selectionCount<p>");
    
    $x = 0;
    while ($x < $selectionCount) {
    $position = $x + 1;
    echo "<b>Position $position is storing $selections[$x]</b><br>";
    
    $ommunicationInsert = "INSERT INTO communication (ownerID, contactID, date, type, details) VALUES ('$session_ownerID', '$selections[$x]', '$timeStamp', '$type', '$details')";
    
    print ("<p>$ommunicationInsert<p>");
    mysql_query($communicationInsert) OR die(mysql_error());
    
    ++$x;
    }  // end while ($x < $selectionCount) 
    
    } // end if ($kind == "kit")
    Here is the output once the button is clicked on needLabel.php. I can't figure out why I'm getting, "Query was empty". r97, are you out there?

    Code:
    UPDATE contacts SET needsKit = 'No', modified = '2005-02-26' where contactID in (931) and ownerID = '1'
    
    Contacts in array = 1
    
    Position 1 is storing 931
    
    INSERT INTO communication (ownerID, contactID, date, type, details) VALUES ('1', '931', '2005-02-26 05:29:00', 'Note', 'A product information kit was assembled today and will be mailed shortly.')
    
    Query was empty
    Convert your dollars into silver coins. www.convert2silver.com

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,247
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by busboy
    The strange this is, I can copy that query, paste into phpMyAdmin and it runs without getting, "Query was empty".
    then it isn't a mysql problem, is it



    perhaps you could get one of the moderators to move this question into the php forum for you
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Moved to a more appropriate forum

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  4. #4
    Non-Member Icheb's Avatar
    Join Date
    Mar 2003
    Location
    Germany
    Posts
    1,474
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $ommunicationInsert = "INSERT INTO communication (ownerID, contactID, date, type, details) VALUES ('$session_ownerID', '$selections[$x]', '$timeStamp', '$type', '$details')";

    print ("<p>$ommunicationInsert<p>");
    mysql_query($communicationInsert) OR die(mysql_error());


    Probably yet another typo that wasted many hours . I've had my fair share of those, too.

  5. #5
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    858
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    That would explain why I could copy and paste the query into myPHPAdmin and it worked fine. Thanks Icheb!!
    Convert your dollars into silver coins. www.convert2silver.com


Bookmarks

Posting Permissions

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