0

i stuck in a unknown problem, when i executed my insertion query i getting this..

Unknown column 'first_val' in 'field list'insert into test_element set `test_id`='100238', `title`='sdd', `unit`='ds', `first_val`='2', `last_val`='33', `status`='', `create_date`='1366873602'

here u can see the error...and my mysql table is like this enter image description here

and my html form is:

 <select id="test" name="test" disabled="disabled" />{test_element_name_list}</option>
                           <div style="display: none;" id="d1"></div>
                           <br />                   
                        </td>
                     </tr>
                     <tr class="dark_txt2">
                        <td width="13%">
                           <span class="Required">*</span>Title:                    
                        </td>
                        <td width="87%">
                           <input id="title" name="title" value="{title}" class="Field400" type="text" style="width:300px" />
                           <div style="display: none;" id="d1"></div>
                           <br />                   
                        </td>
                     </tr>
                     <tr class="dark_txt1">
                        <td width="13%">
                           <span class="Required">*</span>Unit:                 
                        </td>
                        <td width="87%">
                           <input id="unit" name="unit" value="{unit}" class="Field400" type="text" style="width:300px" />
                           <div style="display: none;" id="d1"></div>
                           <br />                   
                        </td>
                     </tr>
                     <tr class="dark_txt1">
                        <td width="13%">
                           <span class="Required">*</span>First Value:                  
                        </td>
                        <td width="87%">
                           <input id="first_val" name="first_val" value="{first_val}" class="Field400" type="text" style="width:300px" />
                           <div style="display: none;" id="d1"></div>
                           <br />                   
                        </td>
                     </tr>
                      <tr class="dark_txt1">
                        <td width="13%">
                           <span class="Required">*</span>Last Value:                   
                        </td>
                        <td width="87%">
                           <input id="last_val" name="last_val" value="{last_val}" class="Field400" type="text" style="width:300px" />
                           <div style="display: none;" id="d1"></div>
                           <br />                   
                        </td>
                     </tr>

and i inserting my post with the help of function, but i am puzzled why my data is not going in mysql table here is code:

$SQL="insert into test_element set
    `test_id`='$R[test_id]',
    `title`='$R[title]',
    `unit`='$R[unit]',
    `first_val`='$R[first_val]',
    `last_val`='$R[last_val]',
    `status`='$R[status]',
    `create_date`='$date'";

a spend lots of hour for sort out this, any help would be highly appreciated...thanx in advance

4

2 回答 2

2

Try this and see

INSERT INTO table_name (column1, column2) VALUES('demo', 'demo');

If not, than am sure you are using wrong table name, or you don't have that column and you are showing a preview of some other table

于 2013-04-25T07:31:05.810 回答
2

I think you are connecting to wrong database. check if you are in a local or remote and check your db connection for knowing which database you are connecting.

于 2013-04-25T07:41:38.907 回答