Jump to content

Unable to Insert Values into database


surajkandukuri

Recommended Posts

HI,

 

I am using the below statement to insert values in to the database but i am not successful in doing so

 

    $insert_query="Insert into cat_completiondate(`EmployeeNumber`, `Cat_Num`, `CategoryJobPosition`, `Obj_Cat_Job`, `Cat_completiondate`, `First Review`, `Second Review`, `Third Review`, `Fourth Review`) values('$employeenumber',1,'$jobid',1-1-1,'$firstreviewdate[0]','$secondreviewdate[0]','$thirdreviewdate[0]','$fourthreviewdate[0]')";

            $query=mysql_query($insert_query) or die("Error updating the database");

             

Link to comment
https://forums.phpfreaks.com/topic/176986-unable-to-insert-values-into-database/
Share on other sites

Hi Mark,

 

        Thank you for your reply, I have used the following query

  echo($insert_query);

And I get the following

 

  Insert into cat_completiondate(`EmployeeNumber`, `Cat_Num`, `CategoryJobPosition`, `Obj_Cat_Job`, `Cat_completiondate`, `First Review`, `Second Review`, `Third Review`, `Fourth Review`) values(34550,'1',1,'1-1-1','1286254800',1317790800,1349413200,1380949200)

 

And,

 

      I am not aware that it will insert only -1 for 1-1-1. IF so how to solve this ??

  $insert_query = "INSERT INTO `cat_completiondate` (`EmployeeNumber`, `Cat_Num`, `CategoryJobPosition`, `Obj_Cat_Job`, `Cat_completiondate`, `First Review`, `Second Review`, `Third Review`, `Fourth Review`) VALUES('$employeenumber', '1', '$jobid', '1-1-1', '$firstreviewdate[0]', '$secondreviewdate[0]', '$thirdreviewdate[0]', '$fourthreviewdate[0]')";

             $query = mysql_query($insert_query) or die("Error updating the database");
              

 

And please use the [_code_] boxes.

 

 

James.

What datatype are the First Review, Second Review, Third Review and Fourth Review columns in the database?

 

Have you tried modifying

or die("Error updating the database")

to

or die("Error updating the database: ".mysql_error())

to see what any error message might be

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.