SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Mar 2011
    Location
    Manchester, UK
    Posts
    227
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP & MySql = Query was empty

    Hi Guys,

    I need some help, when i try to load my Query i keep getting the following message:

    Query was empty

    I've gone over my code and i cant work out why, iv tried to echo the query too but theres nothing showing. Below is my code, can someone see the problem and help me please? Thank you in advance!

    PHP Code:
    //Add Lead To Database
    mysql_connect(localhost,$username,$password);
    @
    mysql_select_db($database) or die( "Oops theres an error, our highly trained monkeys have been notified.");

    $query sprintf('INSERT INTO leads (ProgramID, ProgramName, AffID, SubID, AdID, ClickIP, LeadIP, Status, Referer, Payout, NetPayout, MerchantPayout, Title, FirstName, LastName, CompanyName, Address1, Address2, City, County, PostCode, Country, Telephone, Mobile, Email Address, TermsAgreed, EmailContact, TelephoneContact, PostContact, UserAgent, IPISP, POFCheck, EmailCheck, IPCheck, UserAgentCheck, FraudCheck, CountryCheck, UniqueID) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)',
                
    quote_smart($ProgramID),
                
    quote_smart($ProgramName),
                
    quote_smart($affid),
                
    quote_smart($subid),
                
    quote_smart($adid),
                
    quote_smart($click),
                
    quote_smart($ip),
                
    quote_smart($status),
                
    quote_smart($referer),
                
    quote_smart($affpayout),
                
    quote_smart($netpayout),
                
    quote_smart($merchantpayout),
                
    quote_smart($title),
                
    quote_smart($firstname),
                
    quote_smart($lastname),
                
    quote_smart($companyname),
                
    quote_smart($address1),
                
    quote_smart($address2),
                
    quote_smart($city),
                
    quote_smart($county),
                
    quote_smart($postcode),
                
    quote_smart($country),
                
    quote_smart($telephone),
                
    quote_smart($mobile),
                
    quote_smart($emailaddress),
                
    quote_smart($termsagreed),
                
    quote_smart($emailcontact),
                
    quote_smart($telephonecontact),
                
    quote_smart($postcontact),
                
    quote_smart($useragent),
                
    quote_smart($ipisp),
                
    quote_smart($emailcheck),
                
    quote_smart($ipcheck),
                
    quote_smart($useragentcheck),
                
    quote_smart($fraudcheck),
                
    quote_smart($countrycheck),
                
    quote_smart($uniqueid));
                echo 
    $query;
    mysql_query($query) or die(mysql_error());
    mysql_close();
    //End 
    You're Help Does Not Go Unnoticed, I have So Far Donated 25 GBP
    To Cancer Research UK As A Thank You To All The SitePoint
    Members That Have Helped Me In The PHP Forum Thank You!

  2. #2
    SitePoint Addict
    Join Date
    Mar 2011
    Location
    Manchester, UK
    Posts
    227
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just so you know i noticed that i had Email Address instead of EmailAddress in the Query as a field name but have changed that. Still get the error though
    You're Help Does Not Go Unnoticed, I have So Far Donated 25 GBP
    To Cancer Research UK As A Thank You To All The SitePoint
    Members That Have Helped Me In The PHP Forum Thank You!

  3. #3
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Two basic things to do in order to debug this -- is it PHPs fault or is it an SQL error?

    Try and echo $query onto the page and inspect it closely.

    Copy that text output and paste it into your db directly, does it work?

  4. #4
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    Ya also might want to count the number of %s's, and the number of variables....
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.


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
  •