...

View Full Version : Totally stuck => MySQL error



InsaneRhino
03-17-2008, 02:41 AM
Im building a questionnaire sort of thing, with the answers to be stored in MySQL. However Im having a problem when I try to insert the data, and the error is vague to say the least. I have spent the last 4 hours trying to fiddle with the code, or do it in different ways. The form is over 1.5k lines long so I wont post the entire thing, only the relevant parts (see below).

The error is:


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 '4, 6, 7, 8, 9, 10, 11, 13, 14, 15a, 15b, 90, 16, 17, 18a, 18b, 18c, 19a, 19b, 19' at line 1

So heres the form code for questions 4-19


<tr>
<td colspan="2" valign="top">
Which best describes the nature of your business?</td>
<td valign="top">
<label><input type="checkbox" name="1a" value="1" /> Grower<br /></label>
<label><input type="checkbox" name="1b" value="1" /> Packer<br /></label>
<label><input type="checkbox" name="1c" value="1" /> Processor<br /></label>
<label><input type="checkbox" name="1d" value="1" /> Importer<br /></label>
<label><input type="checkbox" name="1e" value="1" /> Secondary Supplier<br /></label>
<label><input type="checkbox" name="1f" value="1" /> Other<br /></label></td>
</tr>
<tr>
<td colspan="2" valign="top"><BR></td>
<td valign="top"><BR></td>
</tr>
<tr>
<td colspan="2" valign="top">
What are your main customer types?</td>
<td valign="top">
<label><input type="checkbox" name="2a" value="1" /> Multiple Retailers<BR /></label>
<label><input type="checkbox" name="2b" value="1" /> Independent Retailers<BR /></label>
<label><input type="checkbox" name="2c" value="1" /> Foodservice<BR /></label>
<label><input type="checkbox" name="2d" value="1" /> Wholesalers<BR /></label>
<label><input type="checkbox" name="2e" value="1" /> Public Sector<BR /></label>
<label><input type="checkbox" name="2f" value="1" /> Other Sectors<br /></label></td>
</tr>
<tr>
<td colspan="2" valign="top"><BR></td>
<td valign="top"><BR></td>
</tr>
<tr>
<td colspan="2" valign="top">
What is your product range?</td>
<td valign="top">
<label><input type="checkbox" name="3a" value="1" /> Beetroot<br /></label>
<label><input type="checkbox" name="3a" value="1" /> Broccoli<br /></label>
<label><input type="checkbox" name="3c" value="1" /> Brown Onions<br /></label>
<label><input type="checkbox" name="3d" value="1" /> Cabbage<br /></label>
<label><input type="checkbox" name="3e" value="1" /> Carrots<br /></label>
<label><input type="checkbox" name="3f" value="1" /> Cauliflower<br /></label>
<label><input type="checkbox" name="3g" value="1" /> Chili Peppers<br /></label>
<label><input type="checkbox" name="3h" value="1" /> Fruit<br /></label>
<label><input type="checkbox" name="3i" value="1" /> Leeks<br /></label>
<label><input type="checkbox" name="3j" value="1" /> Nuts<br /></label>
<label><input type="checkbox" name="3k" value="1" /> Mild Onions<br /></label>
<label><input type="checkbox" name="3l" value="1" /> Parsnips<br /></label>
<label><input type="checkbox" name="3m" value="1" /> Potatoes<br /></label>
<label><input type="checkbox" name="3n" value="1" /> Red Onions<br /></label>
<label><input type="checkbox" name="3o" value="1" /> Shallots<br /></label>
<label><input type="checkbox" name="3p" value="1" /> Spring Onions<br /></label>
<label><input type="checkbox" name="3q" value="1" /> Swede<br /></label>
<label><input type="checkbox" name="3r" value="1" /> Turnips</label></td>
</tr>
<tr>
<td colspan="2" valign="top"><BR></td>
<td valign="top"><BR></td>
</tr>
<tr>
<td colspan="2" valign="top">
<font class="header">Product and Specifications</font></td>
<td valign="top"><BR></td>
</tr>
<tr>
<td colspan="2" valign="top">
Are all products supplied to JSH to be fully traceable?</td>
<td valign="top">
<label><input type="radio" name="4" value="1" /> Back to source (if not your own product)<br /></label>
<label><input type="radio" name="4" value="2" /> Back to field (in all cases)<br /></label>
<label><input type="radio" name="4" value="3" /> Forward to all customers</label></td>
</tr>
<tr>
<td colspan="2" valign="top">
Please describe how this process works</td>
<td valign="top">
<label><textarea name="5" cols="50" rows="5"></textarea></label></td>
</tr>
<tr>
<td colspan="2" valign="top"><BR></td>
<td valign="top"><BR></td>
</tr>
<tr>
<td colspan="2" valign="top">
Do you have a documented product recall procedure?</td>
<td valign="top">
<label><input type="radio" name="6" value="yes" /> Yes<br /></label>
<label><input type="radio" name="6" value="no" checked="checked"/> No</label></td>
</tr>
<tr>
<td colspan="2" valign="top"><BR></td>
<td valign="top"><BR></td>
</tr>
<tr>
<td colspan="2" valign="top">
<font class="header">Quality System</font></td>
<td valign="top"><BR></td>
</tr>
<tr>
<td colspan="2" valign="top">
What is the basis of your site controls?</td>
<td valign="top">
<label><input type="radio" name="7" value="a" /> Quality Assurance<br /></label>
<label><input type="radio" name="7" value="b" /> Quality Control<br /></label></td>
</tr>
<tr>
<td colspan="2" valign="top"><BR></td>
<td valign="top"><BR></td>
</tr>
<tr>
<td colspan="2" valign="top">
Does the company have a formal, documented Quality Management System?</td>
<td valign="top">
<label><input type="radio" name="8" value="yes" /> Yes<br /></label>
<label><input type="radio" name="8" value="no" checked="checked"/> No</label></td>
</tr>
<tr>
<td colspan="2" valign="top"><BR></td>
<td valign="top"><BR></td>
</tr>
<tr>
<td colspan="2" valign="top">
Do you have a documented HACCP system?</td>
<td valign="top">
<label><input type="radio" name="9" value="yes" /> Yes<br /></label>
<label><input type="radio" name="9" value="no" checked="checked"/>No</label></td>
</tr>
<tr>
<td colspan="2" valign="top"><BR></td>
<td valign="top"><BR></td>
</tr>
<tr>
<td colspan="2" valign="top">
Have you established effective monitoring &amp; control off all CCP’S?</td>
<td valign="top">
<label><input type="radio" name="10" value="yes" /> Yes<br /></label>
<label><input type="radio" name="10" value="no" checked="checked"/> No</label></td>
</tr>
<tr>
<td colspan="2" valign="top"><BR></td>
<td valign="top"><BR></td>
</tr>
<tr>
<td colspan="2" valign="top">
<font class="header">Legislation and Insurance</font></td>
<td valign="top"><BR></td>
</tr>
<tr>
<td colspan="2" valign="top">
Are you subject to an improvement notice, emergency prohibition order or an emergency control order under the food safety act 1990?</td>
<td valign="top">
<label><input type="radio" name="11" value="yes" /> Yes<br /></label>
<label><input type="radio" name="11" value="no" checked="checked"/> No</label></td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td valign="top">If so, please provide details</td>
<td valign="top">
<textarea name="12" cols="50" rows="5"></textarea></td>
</tr>
<tr>
<td colspan="2" valign="top"><BR></td>
<td valign="top"><BR></td>
</tr>
<tr>
<td colspan="2" valign="top">
Do you have Product Liability Insurance cover?</td>
<td valign="top">
<label><input type="radio" name="13" value="yes" /> Yes<br /></label>
<label><input type="radio" name="13" value="no" checked="checked"/> No</label></td>
</tr>
<tr>
<td colspan="2" valign="top"><BR></td>
<td valign="top"><BR></td>
</tr>
<tr>
<td colspan="2" valign="top">
Do you have a product warranty statement?</td>
<td valign="top">
<label><input type="radio" name="14" value="yes" /> Yes<br /></label>
<label><input type="radio" name="14" value="no" checked="checked"/> No</label></td>
</tr>
<tr>
<td colspan="2" valign="top"><BR></td>
<td valign="top"><BR></td>
</tr>
<tr>
<td colspan="2" valign="top">
<font class="header">Packhouse Premises</font></td>
<td valign="top"><BR></td>
</tr>
<tr>
<td colspan="2" valign="top">
When was the packhouse built?</td>
<td valign="top"><select name="15a">
<option>MM</option>
<option>01</option>
<option>02</option>
<option>03</option>
<option>04</option>
<option>05</option>
<option>06</option>
<option>07</option>
<option>08</option>
<option>09</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select>
<select name="15b">
<option>YYYY</option>
<?php
for ($year=date("Y"); $year >= 1800 ;$year--){
?>
<option value="<?php echo $year?>"><?php echo $year?></option>
<?php

}
?>
</select></td>
</tr>
<tr>
<td colspan="2" valign="top"><BR></td>
<td valign="top"><BR></td>
</tr>
<tr>
<td colspan="2" valign="top">
Was the packhouse purpose built?</td>
<td valign="top">
<label><input type="radio" name="90" value="yes" /> Yes</label><br />
<label><input type="radio" name="90" value="no" checked="checked"/> No</label></td>
</tr>
<tr>
<td colspan="2" valign="top"><BR></td>
<td valign="top"><BR></td>
</tr>
<tr>
<td colspan="2" valign="top">
Which best describes where the packhouse is located?</td>
<td valign="top">
<label><input type="radio" name="16" value="a" /> Rural area</label><br />
<label><input type="radio" name="16" value="b" /> Residential area</label><br />
<label><input type="radio" name="16" value="c" /> Industrial area</label><BR>
</td>


</tr>
<tr>
<td colspan="2" valign="top"><BR></td>
<td valign="top"><BR></td>
</tr>
<tr>
<td colspan="2" valign="top">
Is the perimeter secure, clean and tidy?</td>
<td valign="top">
<label><input type="radio" name="17" value="yes" /> Yes<br /></label>
<label><input type="radio" name="17" value="no" checked="checked"/> No</label></td>
</tr>
<tr>
<td colspan="2" valign="top"><BR></td>
<td valign="top"><BR></td>
</tr>
<tr>
<td colspan="2" valign="top">
Are the loading areas:</td>
<td valign="top">
<label><input type="checkbox" name="18a" value="1" /> Restricted access</label><br />
<label><input type="checkbox" name="18b" value="1" /> Level</label><br />
<label><input type="checkbox" name="18c" value="1" /> Covered</label>
</td>
</tr>
<tr>
<td colspan="2" valign="top"><BR></td>
<td valign="top"><BR></td>
</tr>
<tr>
<td colspan="2" valign="top">
Are the following in a good state of repair?</td>
<td valign="top"><table width="103" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="45"></td>
<td width="29" align="center">Yes</td>
<td width="29" align="center">No</td>
</tr>
<tr>
<td>Ceiling</td>
<td align="center"><input type="radio" name="19a" value="yes" /></td>
<td align="center"><input type="radio" name="19a" value="no" checked="checked" /></td>
</tr>
<tr>
<td>Walls</td>
<td align="center"><input type="radio" name="19b" value="yes" /></td>
<td align="center"><input type="radio" name="19b" value="no" checked="checked" /></td>
</tr>
<tr>
<td>Floors</td>
<td align="center"><input type="radio" name="19c" value="yes" /></td>
<td align="center"><input type="radio" name="19c" value="no" checked="checked" /></td>
</tr>
</table></td>
</tr>


Heres the INSERT script (the entire thing)


$sql = "INSERT INTO tbl_supplieranswers (userid, 1a, 1b, 1c, 1d, 1e, 1f, 2a, 2b, 2c, 2d, 2e, 2f, 3a, 3b, 3c, 3d, 3e, 3f, 3g, 3h, 3i, 3j, 3k, 3l, 3m, 3n, 3o, 3p, 3q, 3r, 4, 6, 7, 8, 9, 10, 11, 13, 14, 15a, 15b, 90, 16, 17, 18a, 18b, 18c, 19a, 19b, 19c, 20, 21, 22, 23a, 23b, 23c, 23d, 23e, 24, 25, 26, 27, 28, 29, 30, 31, 32a, 32b, 32c, 32d, 33, 34, 35, 36, 37a, 37b3, 37c, 37d, 37e, 37f, 37g, 37h, 37i, 37j, 37k, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89) VALUES ('$id', '$1a', '$1b', '$1c', '$1d', '$1e', '$1f', '$2a', '$2b', '$2c', '$2d', '$2e', '$2f', '$3a', '$3b', '$3c', '$3d', '$3e', '$3f', '$3g', '$3h', '$3i', '$3j', '$3k', '$3l', '$3m', '$3n', '$3o', '$3p', '$3q', '$3r', '$4', '$6', '$7', '$8', '$9', '$10', '$11', '$13', '$14', '$15a', '$15b', '$90', '$16', '$17', '$18a', '$18b', '$18c', '$19a', '$19b', '$19c', '$20', '$21', '$22', '$23a', '$23b', '$23c', '$23d', '$23e', '$24', '$25', '$26', '$27', '$28', '$29', '$30', '$31', '$32a', '$32b', '$32c', '$32d', '$33', '$34', '$35', '$36', '$37a', '$37b', '$37c', '$37d', '$37e', '$37f', '$37g', '$37h', '$37i', '$37j', '$37k', '$38', '$39', '$40', '$41', '$42', '$43', '$44', '$45', '$46', '$47', '$48', '$49', '$50', '$51', '$52', '$53', '$54', '$55', '$56', '$57', '$58', '$59', '$60', '$61', '$62', '$63', '$64', '$65', '$66', '$67', '$68', '$69', '$70', '$71', '$72', '$73', '$74', '$75', '$76', '$77', '$78', '$79', '$80', '$81', '$82', '$83', '$84', '$85', '$86', '$87', '$88', '$89')";

The variables in the SQL are just:


$q1a = $_POST['1a'];
$q1b = $_POST['1b'];
$q1c = $_POST['1c'];
$q1d = $_POST['1d'];
etc
etc


This is because I was trying to remove as many possible causes for the error message. I thought the problem might have been because of the checkboxes in question 1,2 and 3, so I put some Ifs in:


if(!isset($_POST['1a'])) {
$q1a = '0';
}
etc
etc

This didnt help at all. I know its not ideal to shove tonnes of code on here, but I have litterally been trying to figure this problem out for over 4 hours and its nearly 2am so im a bit tired :). If anyone could shine a little light on what is causing the error I would love you forever.

Thanks so much.

PS if a link to the page would help I can provide it, but I dont want to post it publically because the system is very vulnerable at this time.

king2k5
03-17-2008, 02:48 AM
try adding addslashes() to all of the POST variables?

InsaneRhino
03-17-2008, 02:57 AM
No change

StupidRalph
03-17-2008, 12:22 PM
In your php by file add for the script to die when it can't execute a query and ALSO have it echo out the mysql_error() and the accompaning $sql variable. Something like



$sql = 'SELECT * FROM table;";
$q = mysql_query($sql) or die(mysql_error() . "\nSQL: " . $sql);

InsaneRhino
03-17-2008, 12:26 PM
I do have that mate, the SQL error I posted above is the error it gives. Its a pretty useless error. I have now changes the query so it uses the newer column=variable SQL, so I can see the variables parsed into it. Heres what its giving now:


4='1', 5='0', 6='no', 7='0', 8='no', 9='no', 10='no', 11='no', 12='', 13='1', 14

Is it possible it is a MySQL problem? Should I post my database structure (or at least the first part)?

StupidRalph
03-17-2008, 12:43 PM
I didn't see your complete SQL statement echoed out....only the less useful piece that is generated from mysql_error(). What is the complete SQL statement? I noticed I missed a quotation and backslash in my original post.

InsaneRhino
03-17-2008, 01:30 PM
Ah right sorry I didnt see the nSQL part. heres the error now:


your MySQL server version for the right syntax to use near '4='1', 5='', 6='no', 7='', 8='no', 9='no', 10='no', 11='no', 12='', 13='1', 14='' at line 1nSQL: INSERT INTO tbl_supplieranswers SET 1a='', 1b='', 1c='', 1d='', 1e='', 1f='', 2a='', 2b='', 2c='', 2d='', 2e='', 2f='', 3a='', 3b='', 3c='', 3d='', 3e='', 3f='', 3g='', 3h='', 3i='', 3j='', 3k='', 3l='', 3m='', 3n='', 3o='', 3p='', 3q='1', 3r='1', 4='1', 5='', 6='no', 7='', 8='no', 9='no', 10='no', 11='no', 12='', 13='1', 14='no', 15a='MM', 15b='YYYY', 90='no', 16='', 17='no', 18a='', 18b='', 18c='', 19a='no', 19b='no', 19c='no', 20='no', 21='no', 22='no', 23a='yes', 23b='yes', 23c='yes', 23d='yes', 23e='yes', 24='no', 25='no', 26='no', 27='no', 28='no', 29='no', 30='no', 31='no', 32a='no', 32b='no', 32c='no', 32d='no', 33='no', 34='no', 35='no', 36='no', 37a='', 37b='', 37c='', 37d='', 37e='', 37f='', 37g='', 37h='', 37i='', 37j='', 37k='', 38='no', 39='', 40='no', 41='no', 42='no', 43='no', 44=no, 45=no, 46=no, 47=no, 48=no, 49=no, 50=no, 51=no, 52=no, 53=no, 54=no, 55=no, 56=, 57=no, 58=no, 59=no, 60=no, 61=no, 62=no, 63=no, 64=no, 65=no, 66=no, 67=d, 68=no, 69=, 70=no, 71=no, 72=no, 73=no, 74=no, 75=no, 76=no, 77=no, 78=no, 79=no, 80=no, 81=no, 82=no, 83=no, 84=no, 85=, 86=no, 87=no, 88=no, 89=$89, userid = 14

InsaneRhino
03-17-2008, 03:34 PM
Heres the layout of the MySQL database if that helps at all.


userid
int(3)

1a
tinyint(1)

1b
tinyint(1)

1c
tinyint(1)

1d
tinyint(1)

1e
tinyint(1)

1f
tinyint(1)

2a
tinyint(1)

2b
tinyint(1)

2c
tinyint(1)

2d
tinyint(1)

2e
tinyint(1)

2f
tinyint(1)

3a
tinyint(1)

3b
tinyint(1)

3c
tinyint(1)

3d
tinyint(1)

3e
tinyint(1)

3f
tinyint(1)

3g
tinyint(1)

3h
tinyint(1)

3i
tinyint(1)

3j
tinyint(1)

3k
tinyint(1)

3l
tinyint(1)

3m
tinyint(1)

3n
tinyint(1)

3o
tinyint(1)

3p
tinyint(1)

3q
tinyint(1)

3r
tinyint(1)

4
tinyint(1)

5
text

6
char(3)

7
char(1)

8
char(3)

9
char(3)

10
char(3)

11
char(3)

12
text

13
char(3)

14
char(3)

15a
char(2)

15b
varchar(4)

90
char(3)

16
char(1)

17
char(3)

18a
tinyint(1)

18b
tinyint(1)

18c
tinyint(1)

19a
char(3)

19b
char(3)

19c
char(3)

20
char(3)

21
char(3)

22
char(3)

23a
char(3)

23b
char(3)

23c
char(3)

23d
char(3)

23e
char(3)

24
char(3)

25
char(3)

26
char(3)

27
char(3)

28
char(3)

29
char(3)

30
char(3)

31
char(3)

32a
char(3)

32b
char(3)

32c
char(3)

32d
char(3)

33
char(3)

34
char(3)

35
char(3)

36
char(3)

37a
tinyint(1)

37b
tinyint(1)

37c
tinyint(1)

37d
tinyint(1)

37e
tinyint(1)

37f
tinyint(1)

37g
tinyint(1)

37h
tinyint(1)

37i
tinyint(1)

37j
tinyint(1)

37k
tinyint(1)

38
char(3)

39
text

40
char(3)

41
char(3)

42
char(3)

43
char(3)

44
char(3)

45
char(3)

46
char(3)

47
char(3)

48
char(3)

49
char(3)

91
text

50
char(3)

51
char(3)

52
char(3)

53
char(3)

54
char(3)

55
char(3)

56
text

57
char(3)

58
char(3)

59
char(3)

60
char(3)

61
char(3)

62
char(3)

63
char(3)

64
char(3)

65
char(3)

66
char(3)

67
char(1)

68
char(3)

69
text

70
char(3)

71
char(3)

72
char(3)

73
char(3)

74
char(3)

75
char(3)

76
char(3)

77
char(3)

78
char(3)

79
char(3)

80
char(3)

81
char(3)

82
char(3)

83
char(3)

84
char(3)

85
char(2)

86
char(3)

87
char(3)

88
char(3)

89
char(3)

_Aerospace_Eng_
03-17-2008, 08:27 PM
You aren't understanding us. Find this line

$sql = "INSERT INTO tbl_supplieranswers (userid, 1a, 1b, 1c, 1d, 1e, 1f, 2a, 2b, 2c, 2d, 2e, 2f, 3a, 3b, 3c, 3d, 3e, 3f, 3g, 3h, 3i, 3j, 3k, 3l, 3m, 3n, 3o, 3p, 3q, 3r, 4, 6, 7, 8, 9, 10, 11, 13, 14, 15a, 15b, 90, 16, 17, 18a, 18b, 18c, 19a, 19b, 19c, 20, 21, 22, 23a, 23b, 23c, 23d, 23e, 24, 25, 26, 27, 28, 29, 30, 31, 32a, 32b, 32c, 32d, 33, 34, 35, 36, 37a, 37b3, 37c, 37d, 37e, 37f, 37g, 37h, 37i, 37j, 37k, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89) VALUES ('$id', '$1a', '$1b', '$1c', '$1d', '$1e', '$1f', '$2a', '$2b', '$2c', '$2d', '$2e', '$2f', '$3a', '$3b', '$3c', '$3d', '$3e', '$3f', '$3g', '$3h', '$3i', '$3j', '$3k', '$3l', '$3m', '$3n', '$3o', '$3p', '$3q', '$3r', '$4', '$6', '$7', '$8', '$9', '$10', '$11', '$13', '$14', '$15a', '$15b', '$90', '$16', '$17', '$18a', '$18b', '$18c', '$19a', '$19b', '$19c', '$20', '$21', '$22', '$23a', '$23b', '$23c', '$23d', '$23e', '$24', '$25', '$26', '$27', '$28', '$29', '$30', '$31', '$32a', '$32b', '$32c', '$32d', '$33', '$34', '$35', '$36', '$37a', '$37b', '$37c', '$37d', '$37e', '$37f', '$37g', '$37h', '$37i', '$37j', '$37k', '$38', '$39', '$40', '$41', '$42', '$43', '$44', '$45', '$46', '$47', '$48', '$49', '$50', '$51', '$52', '$53', '$54', '$55', '$56', '$57', '$58', '$59', '$60', '$61', '$62', '$63', '$64', '$65', '$66', '$67', '$68', '$69', '$70', '$71', '$72', '$73', '$74', '$75', '$76', '$77', '$78', '$79', '$80', '$81', '$82', '$83', '$84', '$85', '$86', '$87', '$88', '$89')";
Change to this

$sql = "INSERT INTO tbl_supplieranswers (userid, 1a, 1b, 1c, 1d, 1e, 1f, 2a, 2b, 2c, 2d, 2e, 2f, 3a, 3b, 3c, 3d, 3e, 3f, 3g, 3h, 3i, 3j, 3k, 3l, 3m, 3n, 3o, 3p, 3q, 3r, 4, 6, 7, 8, 9, 10, 11, 13, 14, 15a, 15b, 90, 16, 17, 18a, 18b, 18c, 19a, 19b, 19c, 20, 21, 22, 23a, 23b, 23c, 23d, 23e, 24, 25, 26, 27, 28, 29, 30, 31, 32a, 32b, 32c, 32d, 33, 34, 35, 36, 37a, 37b3, 37c, 37d, 37e, 37f, 37g, 37h, 37i, 37j, 37k, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89) VALUES ('$id', '$1a', '$1b', '$1c', '$1d', '$1e', '$1f', '$2a', '$2b', '$2c', '$2d', '$2e', '$2f', '$3a', '$3b', '$3c', '$3d', '$3e', '$3f', '$3g', '$3h', '$3i', '$3j', '$3k', '$3l', '$3m', '$3n', '$3o', '$3p', '$3q', '$3r', '$4', '$6', '$7', '$8', '$9', '$10', '$11', '$13', '$14', '$15a', '$15b', '$90', '$16', '$17', '$18a', '$18b', '$18c', '$19a', '$19b', '$19c', '$20', '$21', '$22', '$23a', '$23b', '$23c', '$23d', '$23e', '$24', '$25', '$26', '$27', '$28', '$29', '$30', '$31', '$32a', '$32b', '$32c', '$32d', '$33', '$34', '$35', '$36', '$37a', '$37b', '$37c', '$37d', '$37e', '$37f', '$37g', '$37h', '$37i', '$37j', '$37k', '$38', '$39', '$40', '$41', '$42', '$43', '$44', '$45', '$46', '$47', '$48', '$49', '$50', '$51', '$52', '$53', '$54', '$55', '$56', '$57', '$58', '$59', '$60', '$61', '$62', '$63', '$64', '$65', '$66', '$67', '$68', '$69', '$70', '$71', '$72', '$73', '$74', '$75', '$76', '$77', '$78', '$79', '$80', '$81', '$82', '$83', '$84', '$85', '$86', '$87', '$88', '$89')";
echo $sql;
Paste what you get on the echo.

InsaneRhino
03-17-2008, 10:12 PM
Heres what I get:


INSERT INTO tbl_supplieranswers SET 1a='', 1b='', 1c='', 1d='', 1e='', 1f='', 2a='', 2b='', 2c='', 2d='', 2e='', 2f='', 3a='', 3b='', 3c='', 3d='', 3e='', 3f='', 3g='', 3h='', 3i='', 3j='', 3k='', 3l='', 3m='', 3n='', 3o='', 3p='', 3q='1', 3r='1', 4='1', 5='', 6='no', 7='', 8='no', 9='no', 10='no', 11='no', 12='', 13='1', 14='no', 15a='MM', 15b='YYYY', 90='no', 16='', 17='no', 18a='', 18b='', 18c='', 19a='no', 19b='no', 19c='no', 20='no', 21='no', 22='no', 23a='yes', 23b='yes', 23c='yes', 23d='yes', 23e='yes', 24='no', 25='no', 26='no', 27='no', 28='no', 29='no', 30='no', 31='no', 32a='no', 32b='no', 32c='no', 32d='no', 33='no', 34='no', 35='no', 36='no', 37a='', 37b='', 37c='', 37d='', 37e='', 37f='', 37g='', 37h='', 37i='', 37j='', 37k='', 38='no', 39='', 40='no', 41='no', 42='no', 43='no', 44='no', 45='no', 46='no', 47='no', 48='no', 49='no', 50='no', 51='no', 52='no', 53='no', 54='no', 55='no', 56='', 57='no', 58='no', 59='no', 60='no', 61='no', 62='no', 63='no', 64='no', 65='no', 66='no', 67='d', 68='no', 69='', 70='no', 71='no', 72='no', 73='no', 74='no', 75='no', 76='no', 77='no', 78='no', 79='no', 80='no', 81='no', 82='no', 83='no', 84='no', 85='', 86='no', 87='no', 88='no', 89='no', userid = 14

tomws
03-18-2008, 04:44 PM
It's your goofy field names, if you'll pardon me saying so. Numeric field names aren't so good. Essentially, you're trying to set the number 4 equal to some value. The workaround is enclosing the field name in backticks (`4`), but better field naming would be better. Confirm this by noticing that your error starts at field 4 - all previous are alphanumeric.

InsaneRhino
03-19-2008, 10:37 AM
It turned out that the error was just that I was trying to enter in 141 column names and only 140 variables.

Talk about an unhelpful error message.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum