SitePoint Sponsor

User Tag List

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

    PHP Script - Stop Working All Of A Sudden

    Hi Guys,

    My PHP script was working fine, now its just suddenly stopped working and is now giving me the following error:

    PHP Code:
    Fatal errorCall to undefined function dies() in /home/****/public_html/****/submit.php on line 52 
    On line 52 is the following:

    PHP Code:
    mysql_query($query) or dies(mysql_error()); 
    Any reason to why my script has just suddenly stopped working?

    Any help would be great.

  2. #2
    does not play well with others frezno's Avatar
    Join Date
    Jan 2003
    Location
    Munich, Germany
    Posts
    1,391
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use die(), not dies();
    We are the Borg. Resistance is futile. Prepare to be assimilated.
    I'm Pentium of Borg.Division is futile.Prepare to be approximated.

  3. #3
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    69 Post(s)
    Tagged
    0 Thread(s)

  4. #4
    SitePoint Addict
    Join Date
    Mar 2011
    Location
    Manchester, UK
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by StarLion View Post
    Oops sorry i didnt see your comment on that. Thanks guys.

    Now i have another problem, i now get the message:

    Column count doesn't match value count at row 1

    ??

    Thank you.

  5. #5
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    69 Post(s)
    Tagged
    0 Thread(s)
    Right. I thought this might be coming.

    In your query, you do this:

    "INSERT INTO tablename VALUES (value1,value2, etc....)"
    the problem is you're not inserting as many values as there are columns. (or too many.)

    To make it easier to keep track, I suggest you add the field names to the query:
    "INSERT INTO tablename(field1,field2....) VALUES (value1,value2...)"
    That way you know you're lining things up correctly.

  6. #6
    SitePoint Addict
    Join Date
    Mar 2011
    Location
    Manchester, UK
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by StarLion View Post
    Right. I thought this might be coming.

    In your query, you do this:

    "INSERT INTO tablename VALUES (value1,value2, etc....)"
    the problem is you're not inserting as many values as there are columns. (or too many.)

    To make it easier to keep track, I suggest you add the field names to the query:
    "INSERT INTO tablename(field1,field2....) VALUES (value1,value2...)"
    That way you know you're lining things up correctly.
    I've done this and still the same error comes up

    Thank you for your continued help.

  7. #7
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    Can you post your query? It will make it easier to debug if we can see it.
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  8. #8
    SitePoint Addict
    Join Date
    Mar 2011
    Location
    Manchester, UK
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by spikeZ View Post
    Can you post your query? It will make it easier to debug if we can see it.
    Here you go

    PHP Code:
    $query=sprintf(  
                  
    'INSERT INTO data (LeadID, AffID, ProID, Mr, FirstName, LastName, Email, DOB, IP, Sub_ID, Date, Time, EmailValid, EmailReason) VALUES ("", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s", "%s")',  
                  
    mysql_real_escape_string($affid),  
                  
    mysql_real_escape_string($p),  
                  
    mysql_real_escape_string($title),  
                  
    mysql_real_escape_string($first),  
                  
    mysql_real_escape_string($last),  
                  
    mysql_real_escape_string($email),  
                  
    mysql_real_escape_string($dob),  
                  
    $ip
                  
    mysql_real_escape_string($subid),  
                  
    $datenow,  
                  
    $timenow,
                  
    $emailok
                  
    ); 
    Thank you.

  9. #9
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    OK, check the number of fields, the number of %s values and also the actual values to be used. If the first field is an auto increment field then you dont need to include it in your insert statement.
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  10. #10
    SitePoint Addict
    Join Date
    Mar 2011
    Location
    Manchester, UK
    Posts
    226
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Big thank you again guys, you have yet again helped me, if you want me to donate some money to a charity let me know which charity. I like to give something back for people that help me out.

    Thanks


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
  •