tfburges Posted August 13, 2008 Share Posted August 13, 2008 PHP Parse error: syntax error, unexpected '[' in D:\\My Documents\\IRLCM_tech_form\\report_select.php on line 795 I'm assuming it's actually referring to line 794, since when I comment that line (and others similar to it) the error message goes away. The last line of the following code is line 797, FYI. All 795 says is "} else {"... I don't understand why I'm getting this error message when $warranty_special_end_value_data_array is clearly defined as an array. if ($data_warranty_info['field_type'] == 'special') { $warranty_special_name_value = $data_warranty_info['special_name_value']; $warranty_special_start_value_data_array = array(); $warranty_special_end_value_data_array = array(); $warranty_special_start_value_field_length_array = array(); $w = 0; $query_warranty_special_start_value = "SELECT * FROM `special_fields` WHERE `special_name_value` = '$warranty_special_name_value'"; $result_warranty_special_start_value = mysql_query($query_warranty_special_start_value, $link) or die ('MYSQL error: ' . mysql_error()); while ($data_warranty_special_start_value = mysql_fetch_array($result_warranty_special_start_value)) { $warranty_special_extension = $data_warranty_special_start_value['extension']; $warranty_special_field_length = $data_warranty_special_start_value['field_length']; if ($data_warranty_special_start_value['unit_type'] == '') { } else { $warranty_separator = $data_warranty_special_start_value['unit_type']; } $warranty_special_start_value = $warranty_start . $warranty_special_extension; $query_warranty_special_start_value_data_array = "SELECT `$warranty_special_start_value` FROM `$selected_form_name_value` WHERE `$warranty_field_desc_value` = '$warranty_when_data' AND `id` = '$one_id'"; $result_warranty_special_start_value_data_array = mysql_query($query_warranty_special_start_value_data_array, $link) or die ('MYSQL error: ' . mysql_error()); $data_warranty_special_start_value_data_array = mysql_fetch_array($result_warranty_special_start_value_data_array); $warranty_special_start_value_data_array[$w] = $data_warranty_special_start_value_data_array[$warranty_special_start_value]; $warranty_special_start_value_field_length_array[$w] = $warranty_special_field_length; if ($warranty_length_units == 'months' AND $w == '0') { $warranty_special_end_value_data_array[$w] = warranty_special_start_value_data_array[$w]+$warranty_length; } else { $warranty_special_end_value_data_array[$w] = warranty_special_start_value_data_array[$w]; } Link to comment https://forums.phpfreaks.com/topic/119507-solved-php-parse-error-syntax-error-unexpected/ Share on other sites More sharing options...
tfburges Posted August 13, 2008 Author Share Posted August 13, 2008 Shoot never mind... hahahaha I'm an idiot... warranty_special_start_value_data_array[$w]; --> $warranty_special_start_value_data_array[$w]; Link to comment https://forums.phpfreaks.com/topic/119507-solved-php-parse-error-syntax-error-unexpected/#findComment-615663 Share on other sites More sharing options...
tfburges Posted August 13, 2008 Author Share Posted August 13, 2008 Wowwww I don't even know what I was thinking. It's not going to work for all cases anyway! Just in case someone else reads this and decides to use it... Use strtotime and mktime instead of the code I posted. Look 'em up for usage. Link to comment https://forums.phpfreaks.com/topic/119507-solved-php-parse-error-syntax-error-unexpected/#findComment-615704 Share on other sites More sharing options...
matthewhaworth Posted August 13, 2008 Share Posted August 13, 2008 Can I just say that your variable names are a bit, OTT lol Link to comment https://forums.phpfreaks.com/topic/119507-solved-php-parse-error-syntax-error-unexpected/#findComment-615705 Share on other sites More sharing options...
tfburges Posted October 14, 2008 Author Share Posted October 14, 2008 LAWL. Can't win around here can I? I used to abbreviate my variables until someone told me I should be more descriptive. Now, I'm more descriptive and I'm told it's over the top. Link to comment https://forums.phpfreaks.com/topic/119507-solved-php-parse-error-syntax-error-unexpected/#findComment-665560 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.