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:

Fatal error: Call to undefined function dies() in /home/****/public_html/****/submit.php on line 52

On line 52 is the following:

mysql_query($query) or dies(mysql_error());

Any reason to why my script has just suddenly stopped working?

Any help would be great.

use [B]die/B, not die[COLOR=Red]s/COLOR;

I did warn you about that :stuck_out_tongue_winking_eye:

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.

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 :frowning:

Thank you for your continued help.

Can you post your query? It will make it easier to debug if we can see it.

Here you go :slight_smile:

$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.

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.

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