Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.