- if(isset($_REQUEST['submit']))
-
{
-
date_default_timezone_set("Asia/Calcutta");
-
$date = date('d/m/Y');
-
$in=$_POST['in'];
-
$out=$_POST['out'];
-
$project1=$_POST['project1'];
-
$hrs1=$_POST['hrs1'];
-
$project2=$_POST['project2'];
-
$hrs2=$_POST['hrs2'];
-
$otherremark=$_POST['otherremark'];
-
$hrs3=$_POST['hrs3'];
-
$total=$_POST['total'];
-
-
-
$result=mysql_query("INSERT into user_tasksheet(today_date,in,out,project1,hrs1,project2,hrs2,otherremark,total) values('".$date."','$in','$out','$project1','$hrs1','$project2','$hrs2','$otherremark','$hrs3',$total)") or die(mysql_error());
-
if(mysql_num_rows()==1)
-
{
-
echo "insert data";
-
}
-
else
-
{
-
-
echo "not insert data";
-
}
-
-
}
-
else
-
{
-
return false;
-
}
-
-
?>
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'in,out,project1,hrs1,project2,hrs2,otherremark,to tal) values('19/08/2012','','',' at line 1
You have 9 fields (columns) and 10 values.
I also noted that your variable values after the date were submitted as constants, in that you did not concatenate the variables with the .
Just a suggestion, if your database is MySQL you may want to use this alternate syntax of name/value pairs. I think it is easier to match up the field with the value like this
INSERT INTO tbl_name SET col_name1=expr1 , col_name2=expr2, ...
So your code would look something like this.
$result=mysql_query("INSERT into user_tasksheet set today_date = '".$date."', in=".$in.", out=".$out.',...
3 1695
You have 9 fields (columns) and 10 values.
I also noted that your variable values after the date were submitted as constants, in that you did not concatenate the variables with the .
Just a suggestion, if your database is MySQL you may want to use this alternate syntax of name/value pairs. I think it is easier to match up the field with the value like this
INSERT INTO tbl_name SET col_name1=expr1 , col_name2=expr2, ...
So your code would look something like this.
$result=mysql_query("INSERT into user_tasksheet set today_date = '".$date."', in=".$in.", out=".$out.',...
Thnk You very much
thnks for suggestion
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'in='4', out='2', project1='ygb', hrs1='2', project2='grtg', hrs2='3', othe' at line 3 - <?php include('conn.php')?>
-
<?php
-
if(isset($_REQUEST['submit']))
-
{
-
date_default_timezone_set("Asia/Calcutta");
-
$date = date('d/m/Y');
-
$in=$_POST['in'];
-
$out=$_POST['out'];
-
$project1=$_POST['project1'];
-
$hrs1=$_POST['hrs1'];
-
$project2=$_POST['project2'];
-
$hrs2=$_POST['hrs2'];
-
$other_remarks=$_POST['other_remark'];
-
$hrs3=$_POST['hrs3'];
-
$total=$_POST['total'];
-
-
$query="INSERT into user_tasksheet SET
-
today_date='".$date."',
-
in='".$in."',
-
out='".$out."',
-
project1='".$project1."',
-
hrs1='".$hrs1."',
-
project2='".$project2."',
-
hrs2='".$hrs2."',
-
other_remark='".$other_remarks."',
-
hrs3='".$hrs3."',
-
total='".$total."'";
-
-
$result=mysql_query($query) or die(mysql_error());
-
if($result)
-
{
-
echo "insert data";
-
}
-
else
-
{
-
-
echo "not insert data";
-
}
-
-
}
-
else
-
{
-
return false;
-
}
-
-
?>
Sign in to post your reply or Sign up for a free account.
Similar topics
by: jason |
last post by:
I am picking up the following error message which is strange as it has only
started happening since I have transferred servers:
Microsoft JET Database Engine error '80004005' Operation must use...
|
by: jason |
last post by:
I am picking up an error message on a straightforward INSERT - do I need an
optimistic-type to get this working....here is is the error:
Microsoft JET Database Engine error '80004005' Operation...
|
by: Alex Vidal |
last post by:
Hi, I have windows 2000 server with IIS and I program ASP.
I use the string: "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=basedatos.mdb;" to data base Access and it always works ok.
But I...
|
by: |
last post by:
I am having trouble figuring out to call a database INSERT procedure from a
simple submit form.
It appears I should use the onclick event to trigger the procedure called
BUT when I do this I...
|
by: INSERT ERROR |
last post by:
I am trying to INSERT record in MYSQL database, but each time the code tries
to execute the command: MySQL_cmdGLAccount.ExecuteNonQuery(), it reports an
error with the message
"COLUMN COUNT...
|
by: INSERT ERROR |
last post by:
I am trying to INSERT record in MYSQL database, but each time the code tries
to execute the command: MySQL_cmdGLAccount.ExecuteNonQuery(), it reports an
error with the message
"COLUMN COUNT...
|
by: pawar karuna |
last post by:
Hi all,
I have designed a database in which there are lot of reltaionships. Sometime i get error stating "jet database engine error" can you please help to solve this problem.
|
by: Greg Corradini |
last post by:
Hello,
I'm trying to perform a simple insert statement into a table called
Parcel_Test (see code below). Yet, I get an error message that I've never
seen before (see traceback below). I've tried...
|
by: Greg Corradini |
last post by:
Hello,
I've never gotten this traceback error before using mx.ODBC. Any ideas about
resolving this issue? The statement and the error it generates are listed
below.
curse.execute("Insert into...
|
by: phuc2583 |
last post by:
I have a problem with an application I developed with code charge. Whenever I
try to access a table in a database I get the following error:
Microsoft JET Database Engine error '80040e09'
Cannot...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |