Query was empty
Posted: Mon Mar 02, 2009 6:27 am
Hello
I have a tick box on my form ($commupdate) which decides if extra data is posted to a DB or not.
The code
Now if the tick box is checked the data is posted no problem, however if the tick box is not checked the mysql displays "Query was empty" but both queries ($sql) are identical?
Hope you can help
Geoff
I have a tick box on my form ($commupdate) which decides if extra data is posted to a DB or not.
The code
Code: Select all
if ( $commupdate == 'on' ) {
$sql="update projects set VSI_NUMBER='$VSI_NUMBER',DESC1='$DESC1',Salesman='$Salesman',ENGINEER ='$ENGINEER',Prod_Spec ='$Prod_Spec'
,CUSTOMER ='$CUSTOMER',SALESGROUP ='$SALESGROUP',SICCODE ='$SICCODE',Conf_fact ='$Conf_Fact',N_E ='$N_E'
,YEARQTY ='$YEARQTY',CHCKLRATIO ='$CHCKLRATIO',VALUEExworks ='$VALUEExworks',COMPET ='$COMPET', DATEIN ='$DATEIN'
,COMMENTS ='$COMMENTS',ACTIONDATE ='$ACTIONDATE',Project_Members ='$Project_Members'
,Gate ='$Gate',Job_No ='$Job_No',Cata_Number ='$Cata_Number',orderrec ='$orderrec',Produced_at ='$Produced_at'
,Status ='$Status',Suspend ='$Suspend',product = '$Product',Comm_Memb ='$Comm_Memb',ECR_NUMB = '$ECR_NUMB' where VSI_NUMBER='$VSI_NUMBER'";
//echo '<pre>sql: '; print_r($sql); echo "\n</pre>\n";
$sql1="insert into project_comments(ID,DESC1,Comments,ActDate,Proj_Member)
values('$VSI_NUMBER','$DESC','$COMMENTS','$ACTIONDATE','$Comm_Memb')";
//echo '<pre>sql1: '; print_r($sql1); echo "\n</pre>\n";
$result=mysql_query($sql,$connection) or die(mysql_error());
$result=mysql_query($sql1,$connection) or die(mysql_error());
}
else {
$sql="update projects set VSI_NUMBER='$VSI_NUMBER',DESC1='$DESC1',Salesman='$Salesman',ENGINEER ='$ENGINEER',Prod_Spec ='$Prod_Spec'
,CUSTOMER ='$CUSTOMER',SALESGROUP ='$SALESGROUP',SICCODE ='$SICCODE',Conf_fact ='$Conf_Fact',N_E ='$N_E'
,YEARQTY ='$YEARQTY',CHCKLRATIO ='$CHCKLRATIO',VALUEExworks ='$VALUEExworks',COMPET ='$COMPET', DATEIN ='$DATEIN'
,COMMENTS ='$COMMENTS',ACTIONDATE ='$ACTIONDATE',Project_Members ='$Project_Members'
,Gate ='$Gate',Job_No ='$Job_No',Cata_Number ='$Cata_Number',orderrec ='$orderrec',Produced_at ='$Produced_at'
,Status ='$Status',Suspend ='$Suspend',product = '$Product',Comm_Memb ='$Comm_Memb',ECR_NUMB = '$ECR_NUMB' where VSI_NUMBER='$VSI_NUMBER'";
// echo '<pre>sql: '; print_r($sql); echo "\n</pre>\n"; 'Always echo BEFORE result
$result=mysql_query($sql,$connection)or die(mysql_error());
}Hope you can help
Geoff