0

hi ... can someone point out whats wrong with this code?... i think i code it correctly but it gives me an error...

<HTML><HEAD>
</HEAD>
<?php
$db_host = 'localhost';
$db_user = '';
$db_pwd = '';
$database = '';
$table = '';

if (!mysql_connect($db_host, $db_user, $db_pwd))   
 die("Can't connect to database");
 if (!mysql_select_db($database)) 
   die("Can't select database");


$v_seriesnox=$_POST['SERIESNO']; 

$v_datex=$_POST['DATE'];

$v_civilstatusx=$_POST['CIVILSTATUS'];

$v_yearsofstayx=$_POST['YEARSOFSTAY'];

$v_addressofcompanyx=$_POST['ADDRESSOFCOMPANY'];

$v_incomex=$_POST['INCOME'];

 $v_spousenatureemployerx=$_POST['SPOUSENATUREEMPLOYER'];
 $v_spousetelnumx=$_POST['SPOUSETELNUM'];
 $v_father2x=$_POST['FATHER2'];
 $v_parent2addressx=$_POST['PARENT2ADDRESS'];
 $v_dependent1x=$_POST['DEPENDENT1'];
 $v_age2x=$_POST['AGE2'];
 $v_school2x=$_POST['SCHOOL2'];
 $v_reference3x=$_POST['REFERENCE3'];
 $v_ref3addressx=$_POST['REF3ADDRESS'];
 $v_ref1telnumx=$_POST['REF1TELNUM'];
 $v_creditor1x=$_POST['CREDITOR1'];
 $v_gross2x=$_POST['GROSS2'];
 $v_balance2x=$_POST['BALANCE2'];
 $v_collateral3x=$_POST['COLLATERAL3'];
 $v_monthx=$_POST['MONTH'];
 $v_accountnox=$_POST['ACCOUNTNO'];
 $v_picx=$_POST['PIC'];
 $v_cednamex=$_POST['CEDNAME'];
  $v_cednox=$_POST['CEDNO'];
 $v_fullnamex=$_POST['FULLNAME'];
 $v_presentaddressx=$_POST['PRESENTADDRESS'];
 $v_agex=$_POST['AGE'];
 $v_companyemployedx=$_POST['COMPANYEMPLOYED'];
 $v_positioncompanyx=$_POST['POSITIONCOMPANY'];
 $v_spousenamex=$_POST['SPOUSENAME'];
 $v_spousepositionx=$_POST['SPOUSEPOSITION'];
 $v_spouseincomex=$_POST['SPOUSEINCOME'];
 $v_mother1x=$_POST['MOTHER1'];
  $v_parent1telnumx=$_POST['PARENT1TELNUM'];
   $v_dependent2x=$_POST['DEPENDENT2'];
    $v_age3x=$_POST['AGE3'];
     $v_school3x=$_POST['SCHOOL3'];
 $v_ref1addressx=$_POST['REF1ADDRESS'];
 $v_ref1relationx=$_POST['REF1RELATION'];
 $v_ref2telnumx=$_POST['REF2TELNUM'];
 $v_creditor2x=$_POST['CREDITOR2'];
 $v_gross3x=$_POST['GROSS3'];
 $v_balance3x=$_POST['BALANCE3'];
 $v_recievedbyx=$_POST['RECIEVEDBY'];
 $v_dateapprovedx=$_POST['DATEAPPROVED'];
 $v_fsinglex=$_POST['FSINGLE'];
 $v_ceddatex=$_POST['CEDDATE'];
 $v_orx=$_POST['OR'];
 $v_dealerx=$_POST['DEALER'];
 $v_previousaddressx=$_POST['PREVIOUSADDRESS'];
 $v_telnumx=$_POST['TELNUM'];
 $v_naturebusinessx=$_POST['NATUREBUSINESS'];
 $v_dateincompanyx=$_POST['DATEINCOMPANY'];
 $v_spouseemployerx=$_POST['SPOUSEEMPLOYER']; 
  $v_spouseagex=$_POST['SPOUSEAGE']; 
   $v_father1x=$_POST['FATHER1']; 
   $v_mother2x=$_POST['MOTHER2'];
   $v_parent2telnumx=$_POST['PARENT2TELNUM']; 
  $v_dependent3x=$_POST['DEPENDENT3']; 
   $v_school1x=$_POST['SCHOOL1']; 
    $v_reference1x=$_POST['REFERENCE1']; 
     $v_ref2addressx=$_POST['REF2ADDRESS'];
 $v_ref2relationx=$_POST['REF2RELATION']; 
  $v_ref3telnumx=$_POST['REF3TELNUM']; 
  $v_creditor3x=$_POST['CREDITOR3'];
   $v_balance1x=$_POST['BALANCE1']; 
    $v_collateral1x=$_POST['COLLATERAL1']; 
     $v_statusx=$_POST['STATUS'];
 $v_idseriesx=$_POST['IDSERIES'];
 $v_penaltyratex=$_POST['PENALTYRATE'];
 $v_fmaridx=$_POST['FMARID'];
 $v_cedplacex=$_POST['CEDPLACE'];
 $v_agentx=$_POST['AGENT'];
 $v_houseownershipx=$_POST['HOUSEOWNERSHIP'];
 $v_companytelnumx=$_POST['COMPANYTELNUM'];
 $v_spouseempdatex=$_POST['SPOUSEEMPDATE'];
 $v_parent1addressx=$_POST['PARENT1ADDRESS'];
 $v_age1x=$_POST['AGE1'];
 $v_reference2x=$_POST['REFERENCE2']; 
 $v_ref3relationx=$_POST['REF3RELATION']; 
 $v_gross1x=$_POST['GROSS1']; 
 $v_collateral2x=$_POST['COLLATERAL2']; 
 $v_lettermemberx=$_POST['LETTERMEMBER'];
$v_cityx=$_POST['CITY'];  




// if textbox is null

if ($v_seriesnox==""  or $v_cityx=="") 

echo "All fields must be entered";

else{
// adding data into database
$query="insert into Information(SERIESNO,DATE,CIVILSTATUS,YEARSOFSTAY,ADDRESSOFCOMPANY,INCOME,SPOUSENATUREEMPLOYER,SPOUSETELNUM,FATHER2,PARENT2ADDRESS,DEPENDENT1 ,AGE2 ,SCHOOL2,REFERENCE3,REF3ADDRESS,REF1TELNUM,CREDITOR1,GROSS2,BALANCE2,COLLATERAL3,MONTH,ACCOUNTNO,PIC,CEDNAME,CEDNO,FULLNAME, PRESENTADDRESS,AGE,COMPANYEMPLOYED,POSITIONCOMPANY,SPOUSENAME,SPOUSEPOSITION,SPOUSEINCOME,MOTHER1,PARENT1TELNUM,DEPENDENT2,AGE3,SCHOOL3,REF1ADDRESS,REF1RELATION,REF2TELNUM,CREDITOR2,GROSS3,BALANCE3,RECIEVEDBY,YEAR,DATEAPPROVED,FSINGLE,CEDDATE,OR,DEALER,PREVIOUSADDRESS,TELNUM,NATUREBUSINESS,DATEINCOMPANY,SPOUSEEMPLOYER,SPOUSEAGE,FATHER1,MOTHER2,PARENT2TELNUM,DEPENDENT3,SCHOOL1,REFERENCE1,REF2ADDRESS,REF2RELATION,REF3RTELNUM,CREDITOR3,BALANCE1,COLLATERAL1,STATUS,IDSERIES,PENALTYRATE,FMARID,CEDPLACE,AGENT,HOUSEOWNERSHIP,COMPANYTELNUM,SPOUSEEMPDATE,PARENT1ADDRESS,AGE1,REFERENCE2,REF3RELATION,GROSS1,COLLATERAL2,LETTERMEBER ,CITY) values ('$v_seriesnox','$v_datex','$v_civilstatusx','$v_yearsofstayx','$v_addressofcompanyx','$v_Incomex','$v_spousenatureemployerx','$v_spousetelnumx','$v_father2x','$v_parent2addressx','$v_dependent1x','$v_age2x','$v_school2x','$v_reference3x','$v_ref3addressx','$v_ref1telnumx','$v_creditor1x','$v_gross2x','$v_balance2x','$v_collateral3x','$v_monthx','$v_accountnox','$v_picx','$v_cednamex','$v_cednox','$v_fullnamex','$v_presentaddressx','$v_agex','$v_companyemployedx','$v_positioncompanyx','$v_spousenamex','$v_spousepositionx','$v_spouseincomex','$v_mother1x','$v_parenttelnumx','$v_dependentx','$v_age3x','$v_school3x','$v_ref1addressx','$v_ref1relationx','$v_ref2telnumx','$v_creditor2x','$v_gross3x','$v_balance3x','$v_recievedbyx','$v_yearx','$v_dateapprovedx','$v_fsinglex','$v_ceddatex','$v_orx','$v_dealerx','$v_previousaddressx','$v_telnumx','$v_naturebusinessx','$v_dateincompanyx','$v_spouseemployerx','$v_spouseagex','$v_father1x','$v_mother2x','$v_parent2telnumx','$v_dependent3x','$v_school1x','$v_reference1x','$v_ref2addressx','$v_ref2relationx','$v_ref3telnumx','$v_creditor3x','$v_balance1x','$v_collateral1x','$v_status','$v_idseries','$v_penaltyratex','$v_fmaridx','$v_cedplacex','$v_agentx','$v_houseownershipx','$v_companytelnumx','$v_spouseempdatex','$v_parent1addressx','$v_age1x','$v_reference2x','$v_ref3relationx','$v_gross1x','$v_collateral2x','$v_lettermemberx','$v_cityx')";

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

echo "Data Has Been Inserted";











}



?>
</html>


-------------------------------------



---------------------HTML code------------------------------

<html>
<table><form action="Insertthis.php" method="POST" id="insert">
<tr><td>
Seriesno
<input type=text name="SERIESNO" >
</td>
<td>Date
<input type=text name="DATE" >
</td>
<td>CivilStatus
<input type=text name="CIVILSTATUS" >
</td>
<td>Yearsofstay
<input type=text name="YEARSOFSTAY" >
</td>
<td>Addressofcompany
<input type=text name="ADDRESSOFCOMPANY" >
</td>
</tr>
<tr>
<td>Income
<input type=text name="INCOME" >
</td>
<td>Spousenatureemployer
<input type=text name="SPOUSENATUREEMPLOYER" >
</td>
<td>Spousetelnum
<input type=text name="SPOUSETELNUM" >
</td>
<td>Father2
<input type=text name="FATHER2" >
</td>
<td>Parent2address
<input type=text name="PARENT2ADDRESS" >
</td>
</tr>
<tr>
<td>Dependent1
<input type=text name="DEPENDENT1" >
</td>
<td>Age2
<input type=text name="AGE2" >
</td><td>School2
<input type=text name="SCHOOL2" >
</td>
<td>Reference3
<input type=text name="REFERENCE3" >
</td>
<td>Ref3address
<input type=text name="REF3ADDRESS" >
</td>
</tr><tr>
<td>"Ref1telnum
<input type=text name="REF1TELNUM" >
</td>
<td>Creditor1
<input type=text name="CREDITOR1" >
</td>
<td>Gross2
<input type=text name="GROSS2" >
</td>
<td>Balance2
<input type=text name="BALANCE2" >
</td>
<td>Collateral3
<input type=text name="COLLATERAL3" ></tr><tr>
</td><td>month
<input type=text name="MONTH" >
</td><td>Accountno
<input type=text name="ACCOUNTNO" >
</td>
<td>PIC
<input type=text name="PIC" >
</td>
<td>cedname
<input type=text name="CEDNAME" >
</td>
<td>cedno
<input type=text name="CEDNO" >
</td></tr><tr>
<td>Fullname
<input type=text name="FULLNAME" >
</td>
<td>PresentAddress
<input type=text name="PRESENTADDRESS" >
</td>
<td>Age
<input type=text name="AGE" >
</td>
<td>Companyemployed
<input type=text name="COMPANYEMPLOYED" >
</td>
<td>PositionCompany
<input type=text name="POSITIONCOMPANY" >
</td></tr><tr>
<td>Spousename
<input type=text name="SPOUSENAME" >
</td>
<td>Spouseposition
<input type=text name="SPOUSEPOSITION" >
</td>
<td>Spouseincome
<input type=text name="SPOUSEINCOME" >
</td>
<td>Mother1
<input type=text name="MOTHER1" >
</td>
<td>Parent1telnum
<input type=text name="PARENT1TELNUM" >
</td>
</tr><tr>
<td>"Dependent2
<input type=text name="DEPENDENT2" >
</td>

<td>Age3
<input type=text name="AGE3" >
</td>

<td>School3
<input type=text name="SCHOOL3" >
</td>

<td>Ref1Address
<input type=text name="REF1ADDRESS" >
</td>

<td>Ref1relation
<input type=text name="REF1RELATION" >
</td>
</tr><tr>

<td>Ref2telnum
<input type=text name="REF2TELNUM" >
</td>

<td>Creditor2
<input type=text name="CREDITOR2" >
</td>
<td>Gross3
<input type=text name="GROSS3" >
</td>
<td>Balance3
<input type=text name="BALANCE3" >
</td>

<td>recievedby
<input type=text name="RECIEVEDBY" >
</td></tr><tr>
<td>year
<input type=text name="year" >
</td>
<td>dateapproved
<input type=text name="dateapproved" >
</td>
<td>fsingle
<input type=text name="fsingle" >
</td>
<td>ceddate
<input type=text name="ceddate" >
</td>

<td>or
<input type=text name="OR" >
</td>
</tr><tr>
<td>Dealer
<input type=text name="DEALER">
</td>
<td>PreviousAddress
<input type=text name="PREVIOUSADDRESS">
</td>
<td>Telnum
<input type=text name="TELNUM" >
</td>

<td>Naturebusiness"
<input type=text name="NATUREBUSINESS" >
</td>

<td>DateinCompany
<input type=text name="DATEINCOMPANY" >
</td>
</tr><tr>
<td>Spousemployer
<input type=text name="SPOUSEEMPLOYER" >
</td>

<td>Spouseage
<input type=text name="SPOUSEAGE" >
</td>

<td>Father1"
<input type=text name="FATHER1" >
</td>

<td>Mother2
<input type=text name="MOTHER2" >
</td>

<td>Parent2telnum
<input type=text name="PARENT2TELNUM" >
</td>
</tr><tr>
<td>"Dependent3
<input type=text name="DEPENDENT3" >
</td>

<td>School1
<input type=text name="SCHOOL1" >
</td>
<td>Reference1
<input type=text name="REFERENCE1" >
</td>
<td>Ref2address
<input type=text name="REF2ADDRESS" >
</td>
<td>Ref2relation
<input type=text name="REF2RELATION" >
</td></tr>
<td>Ref3telnum
<input type=text name="REF3TELNUM" >
</td>
<td>"Creditor3
<input type=text name="CREDITOR3" >
</td>
<td>"Balance1
<input type=text name="BALANCE1" >
</td>
<td>Collateral1
<input type=text name="COLLATERAL1" >
</td>
<td>status
<input type=text name="STATUS" >
</td></tr><tr>
<td>idseries
<input type=text name="IDSERIES" >
</td>
<td>penaltyrate
<input type=text name="PENALTYRATE" >
</td>
<td>fmarid
<input type=text name="FMARID" >
</td>
<td>cedplace
<input type=text name="CEDPLACE" >
</td>
<td>agent
<input type=text name="AGENT" >
</td></tr><tr>
<td>Houseownership
<input type=text name="HOUSEOWNERSHIP" >
</td>
<td>CompanyTelnum
<input type=text name="COMPANYTELNUM" >
</td>
<td>Spouseempdate
<input type=text name="SPOUSEEMPDATE" >
</td>
<td>Parent1address
<input type=text name="PARENT1ADDRESS" >
</td>
<td>age1
<input type=text name="AGE1" >
</td></tr><tr>
<td>Reference2
<input type=text name="REFERENCE2" >
</td>
<td>Ref3relation
<input type=text name="REF3RELATION" >
</td>
<td>"Gross1
<input type=text name="GROSS1" >
</td>
<td>Collateral2
<input type=text name="COLLATERAL2" >
</td></tr><tr>
<td>lettermember
<input type=text name="LETTERMEMBER" >
</td>
<td>City
<input type=text name="CITY" >
</td>
<td>
  <input type="submit" name="submit" value="ADD DATA" >
</td>
</tr>
</tr>
<table>
</html>

Edited by pyTony: fixed formatting

3
Contributors
16
Replies
17
Views
6 Years
Discussion Span
Last Post by uselessninja
0

copy and paste the error message you get

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 'OR,DEALER,PREVIOUSADDRESS,TELNUM,NATUREBUSINESS,DATEINCOMPANY,SPOUSEEMPLOYER,SPO' at line 1


here .... ive check it but it gets error :( (btw for the sake of test, i cahnge all of data types to TEXT )

Edited by uselessninja: n/a

0

this is a syntax error in MYSQL , probably you are missing a semicolon or ending parenthesis or you do not have white space between your commands .
for example try to put space between "into" and the table name "info".
and by the way your sql statement or the variable ($query) is not posted here completely try to post it again independently inside CODE clock in the editor , So we can have better view for your code instead of pasting it as its

0

this is a syntax error in MYSQL , probably you are missing a semicolon or ending parenthesis or you do not have white space between your commands .
for example try to put space between "into" and the table name "info".
and by the way your sql statement or the variable ($query) is not posted here completely try to post it again independently inside CODE clock in the editor , So we can have better view for your code instead of pasting it as its

if ($v_seriesnox=="" or $v_cityx=="")

echo "All fields must be entered";

else{
// adding data into database
$query="insert into Information(SERIESNO,DATE,CIVILSTATUS,YEARSOFSTAY,ADDRESSOFCOMPANY,INCOME,SPOUSENATUREEMPLOYER,SPOUSETELNUM,FATHER2,PARENT2ADDRESS,DEPENDENT1 ,AGE2 ,SCHOOL2,REFERENCE3,REF3ADDRESS,REF1TELNUM,CREDITOR1,GROSS2,BALANCE2,COLLATERAL3,MONTH,ACCOUNTNO,PIC,CEDNAME,CEDNO,FULLNAME, PRESENTADDRESS,AGE,COMPANYEMPLOYED,POSITIONCOMPANY,SPOUSENAME,SPOUSEPOSITION,SPOUSEINCOME,MOTHER1,PARENT1TELNUM,DEPENDENT2,AGE3,SCHOOL3,REF1ADDRESS,REF1RELATION,REF2TELNUM,CREDITOR2,GROSS3,BALANCE3,RECIEVEDBY,YEAR,DATEAPPROVED,FSINGLE,CEDDATE,OR,DEALER,PREVIOUSADDRESS,TELNUM,NATUREBUSINESS,DATEINCOMPANY,SPOUSEEMPLOYER,SPOUSEAGE,FATHER1,MOTHER2,PARENT2TELNUM,DEPENDENT3,SCHOOL1,REFERENCE1,REF2ADDRESS,REF2RELATION,REF3RTELNUM,CREDITOR3,BALANCE1,COLLATERAL1,STATUS,IDSERIES,PENALTYRATE,FMARID,CEDPLACE,AGENT,HOUSEOWNERSHIP,COMPANYTELNUM,SPOUSEEMPDATE,PARENT1ADDRESS,AGE1,REFERENCE2,REF3RELATION,GROSS1,COLLATERAL2,LETTERMEBER ,CITY) values ('$v_seriesnox','$v_datex','$v_civilstatusx','$v_yearsofstayx','$v_addressofcompanyx','$v_Incomex','$v_spousenatureemployerx','$v_spousetelnumx','$v_father2x','$v_parent2addressx','$v_dependent1x','$v_age2x','$v_school2x','$v_reference3x','$v_ref3addressx','$v_ref1telnumx','$v_creditor1x','$v_gross2x','$v_balance2x','$v_collateral3x','$v_monthx','$v_accountnox','$v_picx','$v_cednamex','$v_cednox','$v_fullnamex','$v_presentaddressx','$v_agex','$v_companyemployedx','$v_positioncompanyx','$v_spousenamex','$v_spousepositionx','$v_spouseincomex','$v_mother1x','$v_parenttelnumx','$v_dependentx','$v_age3x','$v_school3x','$v_ref1addressx','$v_ref1relationx','$v_ref2telnumx','$v_creditor2x','$v_gross3x','$v_balance3x','$v_recievedbyx','$v_yearx','$v_dateapprovedx','$v_fsinglex','$v_ceddatex','$v_orx','$v_dealerx','$v_previousaddressx','$v_telnumx','$v_naturebusinessx','$v_dateincompanyx','$v_spouseemployerx','$v_spouseagex','$v_father1x','$v_mother2x','$v_parent2telnumx','$v_dependent3x','$v_school1x','$v_reference1x','$v_ref2addressx','$v_ref2relationx','$v_ref3telnumx','$v_creditor3x','$v_balance1x','$v_collateral1x','$v_status','$v_idseries','$v_penaltyratex','$v_fmaridx','$v_cedplacex','$v_agentx','$v_houseownershipx','$v_companytelnumx','$v_spouseempdatex','$v_parent1addressx','$v_age1x','$v_reference2x','$v_ref3relationx','$v_gross1x','$v_collateral2x','$v_lettermemberx','$v_cityx')";

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

echo "Data Has Been Inserted";

0

Everything looks fine to me , I can not tell where is the problem , but it seems like its in the fields name of the table
I have a suggestion (if you are inserting to the whole table fields) and only if this is the case , you can modify your sql statement slightly to be

<?php

$query = "INSERT INTO Information VALUES ('$v_seriesnox','$v_datex','$v_civilstatusx','$v_yearsofstayx','$v_addressofcompanyx','$v_Incomex','$v_spousenatureemployerx','$v_spousetelnumx','$v_father2x','$v_parent2addressx','$v_dependent1x','$v_age2x','$v_school2x','$v_reference3x','$v_ref3addressx','$v_ref1telnumx','$v_creditor1x','$v_gross2x','$v_balance2x','$v_collateral3x','$v_monthx','$v_accountnox','$v_picx','$v_cednamex','$v_cednox','$v_fullnamex','$v_presentaddressx','$v_agex','$v_companyemployedx','$v_positioncompanyx','$v_spousenamex','$v_spousepositionx','$v_spouseincomex','$v_mother1x','$v_parenttelnumx','$v_dependentx','$v_age3x','$v_school3x','$v_ref1addressx','$v_ref1relationx','$v_ref2telnumx','$v_creditor2x','$v_gross3x','$v_balance3x','$v_recievedbyx','$v_yearx','$v_dateapprovedx','$v_fsinglex','$v_ceddatex','$v_orx','$v_dealerx','$v_previousaddressx','$v_telnumx','$v_naturebusinessx','$v_dateincompanyx','$v_spouseemployerx','$v_spouseagex','$v_father1x','$v_mother2x','$v_parent2telnumx','$v_dependent3x','$v_school1x','$v_reference1x','$v_ref2addressx','$v_ref2relationx','$v_ref3telnumx','$v_creditor3x','$v_balance1x','$v_collateral1x','$v_status','$v_idseries','$v_penaltyratex','$v_fmaridx','$v_cedplacex','$v_agentx','$v_houseownershipx','$v_companytelnumx','$v_spouseempdatex','$v_parent1addressx','$v_age1x','$v_reference2x','$v_ref3relationx','$v_gross1x','$v_collateral2x','$v_lettermemberx','$v_cityx')"; 

$handle =mysql_query($query);
if ($handle) {echo "Data inserted successfuly";}else{die(mysql_error());}

?>

Edited by Amr87: n/a

0

ive tried ur suggestion but it generate an error "Column count doesn't match value count at row 1" ive check every field and i think i didnt miss ( i believe )

btw this is my final code but no luck again

<HTML><HEAD>
</HEAD>
<?php
$db_host = 'localhost';
$db_user = '';
$db_pwd = '';
$database = '';
$table = 'Information';

if (!mysql_connect($db_host, $db_user, $db_pwd))
die("Can't connect to database");
if (!mysql_select_db($database))
die("Can't select database");


$v_seriesnox=$_POST;
$v_datex=$_POST;
$v_civilstatusx=$_POST;
$v_yearsofstayx=$_POST;
$v_addressofcompanyx=$_POST;
$v_incomex=$_POST;
$v_spousenatureemployerx=$_POST;
$v_spousetelnumx=$_POST;
$v_father2x=$_POST;
$v_parent2addressx=$_POST;
$v_dependent1x=$_POST;
$v_age2x=$_POST;
$v_school2x=$_POST;
$v_reference3x=$_POST;
$v_ref3addressx=$_POST;
$v_ref1telnumx=$_POST;
$v_creditor1x=$_POST;
$v_gross2x=$_POST;
$v_balance2x=$_POST;
$v_collateral3x=$_POST;
$v_monthx=$_POST;
$v_accountnox=$_POST;
$v_picx=$_POST;
$v_cednamex=$_POST;
$v_cednox=$_POST;
$v_fullnamex=$_POST;
$v_presentaddressx=$_POST;
$v_agex=$_POST;
$v_companyemployedx=$_POST;
$v_positioncompanyx=$_POST;
$v_spousenamex=$_POST;
$v_spousepositionx=$_POST;
$v_spouseincomex=$_POST;
$v_mother1x=$_POST;
$v_parent1telnumx=$_POST;
$v_dependent2x=$_POST;
$v_age3x=$_POST;
$v_school3x=$_POST;
$v_ref1addressx=$_POST;
$v_ref1relationx=$_POST;
$v_ref2telnumx=$_POST;
$v_creditor2x=$_POST;
$v_gross3x=$_POST;
$v_balance3x=$_POST;
$v_recievedbyx=$_POST;
$v_yearx=$_POST;
$v_dateapprovedx=$_POST;
$v_fsinglex=$_POST;
$v_ceddatex=$_POST;
$v_orx=$_POST;
$v_dealerx=$_POST;
$v_previousaddressx=$_POST;
$v_telnumx=$_POST;
$v_naturebusinessx=$_POST;
$v_dateincompanyx=$_POST;
$v_spouseemployerx=$_POST;
$v_spouseagex=$_POST;
$v_father1x=$_POST;
$v_mother2x=$_POST;
$v_parent2telnumx=$_POST;
$v_dependent3x=$_POST;
$v_school1x=$_POST;
$v_reference1x=$_POST;
$v_ref2addressx=$_POST;
$v_ref2relationx=$_POST;
$v_ref3telnumx=$_POST;
$v_creditor3x=$_POST;
$v_balance1x=$_POST;
$v_collateral1x=$_POST;
$v_statusx=$_POST;
$v_idseriesx=$_POST;
$v_penaltyratex=$_POST;
$v_fmaridx=$_POST;
$v_cedplacex=$_POST;
$v_agentx=$_POST;
$v_houseownershipx=$_POST;
$v_companytelnumx=$_POST;
$v_spouseempdatex=$_POST;
$v_parent1addressx=$_POST;
$v_age1x=$_POST;
$v_reference2x=$_POST;
$v_ref3relationx=$_POST;
$v_gross1x=$_POST;
$v_collateral2x=$_POST;
$v_lettermemberx=$_POST;
$v_cityx=$_POST;


// if textbox is null

if ($v_seriesnox=="" or $v_cityx=="")

echo "All fields must be entered";

else{
// adding data into database
$query="INSERT INTO Information VALUES('$v_seriesnox','$v_datex','$v_civilstatusx','$v_yearsofstayx','$v_addressofcompanyx','$v_Incomex','$v_spousenatureemployerx','$v_spousetelnumx','$v_father2x','$v_parent2addressx','$v_dependent1x','$v_age2x','$v_school2x','$v_reference3x','$v_ref3addressx','$v_ref1telnumx','$v_creditor1x','$v_gross2x','$v_balance2x','$v_collateral3x','$v_monthx','$v_accountnox','$v_picx','$v_cednamex','$v_cednox','$v_fullnamex','$v_presentaddressx','$v_agex','$v_companyemployedx','$v_positioncompanyx','$v_spousenamex','$v_spousepositionx','$v_spouseincomex','$v_mother1x','$v_parenttelnumx','$v_dependent2x','$v_age3x','$v_school3x','$v_ref1addressx','$v_ref1relationx','$v_ref2telnumx','$v_creditor2x','$v_gross3x','$v_balance3x','$v_recievedbyx','$v_yearx','$v_dateapprovedx','$v_fsinglex','$v_ceddatex','$v_orx','$v_dealerx','$v_previousaddressx','$v_telnumx','$v_naturebusinessx','$v_dateincompanyx','$v_spouseemployerx','$v_spouseagex','$v_father1x','$v_mother2x','$v_parent2telnumx','$v_dependent3x','$v_school1x','$v_reference1x','$v_ref2addressx','$v_ref2relationx','$v_ref3telnumx','$v_creditor3x','$v_balance1x','$v_collateral1x','$v_statusx','$v_idseriesx','$v_penaltyratex','$v_fmaridx','$v_cedplacex','$v_agentx','$v_houseownershipx','$v_companytelnumx','$v_spouseempdatex','$v_parent1addressx','$v_age1x','$v_reference2x','$v_ref3relationx','$v_gross1x','$v_collateral2x','$v_lettermemberx','$v_cityx')";

$handle =mysql_query($query);
if ($handle) {echo "Data inserted successfuly";}else{die(mysql_error());}


}

?>
</html>

Edited by uselessninja: n/a

0

Hi

if ($v_seriesnox=="" or $v_cityx=="")

change the above line as below

if ($v_seriesnox=='' || $v_cityx=='')
0

Hi

if ($v_seriesnox=="" or $v_cityx=="")

change the above line as below

if ($v_seriesnox=='' || $v_cityx=='')

thankzz for ur suggestion friend.... but still got error :(

0

This Error Means that you are not inserting to the whole fields table but to a specific fields
I told you you should make sure that you are inserting to the whole table fields
and if you are sure of that make sure that you did not inserted a duplicated value
or that you did not miss a value to insert

0

or else you try to echo $query; and try to insert into database and try to find out the problem.

try this also

if ($v_seriesnox=='' || $v_cityx=='')
$query = ....
mysql_db_query($database,$query);
$change=mysql_insert_id();

Edited by rpv_sen: n/a

0

This Error Means that you are not inserting to the whole fields table but to a specific fields
I told you you should make sure that you are inserting to the whole table fields
and if you are sure of that make sure that you did not inserted a duplicated value
or that you did not miss a value to insert

umm i think duplicate value is not a problem and if i missed on inputing value its not a problem (except for serialno and city )....well there is a
primary key(ID (auto incremented)) that makes them all 87 but i dont think adding a value of it cannot generate error..


heres what my table look like for good view:

>>>>>>>>>>>>>[IMG]http://i51.tinypic.com/11c9vgk.jpg[/IMG] <<<<<<<<<

Edited by uselessninja: n/a

0

Sorry , what I meant by duplicated value is that you inserted an extra value for example if the table have 60 fields and you inserted 61 that will cause that error
or if you inserted 59 and you did not set a default value for the field you missed , that also causes an error
please check that and make sure that everything is ok and retry the script that I gave it to u again and let me know what happened

0

Sorry , what I meant by duplicated value is that you inserted an extra value for example if the table have 60 fields and you inserted 61 that will cause that error
or if you inserted 59 and you did not set a default value for the field you missed , that also causes an error
please check that and make sure that everything is ok and retry the script that I gave it to u again and let me know what happened

weeewww...... THANK YOU FRIEND and ALSO THANKZ TO EVERYONE WHO GAVE SUGGESTIONS i already found the error and fix it ....

FIRST ERROR: " I think php or mysql interpret it as function not a variable
(the field i name as "OR" ) kinda hard one thats y it generate that error

2ND ONE: yeah i admit i was wrong i missed one :D


thank you everyone :)

0

u welcome,plz mark this thread as solved

finished :)....so to everyone viewing this "DONT USE METHODS/FUNCTION as variabe " (lesson learned) :D

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.