Re: ABVFP doesnt ADD new colum to DB
Please do NOT open multiple threads about the same issue.
The problem was laying with the automatic update of the database with the new column, because no definition of the type of column existed, and this would cause the error. This is a result of the continous updates i have been making to the code to ve able to satisfy your needs as posted here. At a point errors are quite easy.
Download the last version from my website. If you have made changes of your own in my code, you will need to implement them yourself.
ABVFP doesnt ADD new colum to DB
Collapse
X
-
ABVFP doesnt ADD new colum to DB
Hello
im trying to add a new feild in my FORM
i get this error :
There has been an unknown error during Column addition. Invalid Query = ALTER TABLE `_Form_Nr_4` ADD `terms` AFTER `price`; .Please contact support at info@dbtechnosystems.com
this is the code i found in the dbts_abvfp.php :
Code:// Check if the field exists in the table, to avoid crashes $result = mysql_list_fields($db_name, $dbts_table, $db); $fieldnumber = mysql_num_fields($result); for ($i = 0; $i < $fieldnumber; $i++) { $fieldstable[$i] = strtolower(mysql_field_name($result, $i)); $last_useful = $fieldnumber - 3; } //--- check if all fields exist in the database or columns have to be added for ($i = 0; $i < (count($ndfieldname)); $i++) { $ndfieldname_tolower = strtolower($ndfieldname[$i]); $query = 'ALTER TABLE `'.$dbts_table.'` '; if (!in_array($ndfieldname_tolower,$fieldstable)) { $query .= 'ADD `'.$ndfieldname_tolower.'` '.$fieldtype[$i].' AFTER `'.$fieldstable[$last_useful].'`;'; $result = mysql_query($query); if (!$result) { $_SESSION[error] = "There has been an unknown error during Column addition. Invalid Query = $query .Please contact support at [EMAIL="info@dbtechnosystems.com"]info@dbtechnosystems.com[/EMAIL]"; mysql_close($db); header("Location: dbts_ABVFP_errorpage.php"); exit; } } $fieldstable[] = $ndfieldname_tolower; } @$query = "INSERT INTO `$dbts_table`("; for ($i = 0; $i < count($ndfieldname); $i++) { $dbfield = strtolower($ndfieldname[$i]); //$dbvalue = $ndfieldvalue[$i]; if (in_array($dbfield,$fieldstable)) { @$query .= "`$dbfield` ,"; } } @$query .= "`Submission_Date` ,"; @$query .= "`IP_Address` "; @$query .= ")"; @$query .= "VALUES ("; for ($i = 0; $i < count($ndfieldname); $i++) { $dbfield = strtolower($ndfieldname[$i]); if (in_array($dbfield,$fieldstable)) { @$query .= "\"$ndfieldvalue[$i]\","; } } @$query .= "\"$Submission_Date\","; @$query .= "\"$ip\""; @$query .= ")" ; $db = mysql_connect($db_host, $db_user, $db_password); if (!$db) { $_SESSION[error] = "There has been a connection problem at line 572:". mysql_error()."Please contact support at [EMAIL="info@dbtechnosystems.com"]info@dbtechnosystems.com[/EMAIL]"; mysql_close($db); header("Location: dbts_ABVFP_errorpage.php"); exit; } $db_selected = mysql_select_db($db_name, $db); if (!$db_selected) { $_SESSION[error] = "There has been a connection problem at line 577:". mysql_error().". Please contact support at [EMAIL="info@dbtechnosystems.com"]info@dbtechnosystems.com[/EMAIL]"; mysql_close($db); header("Location: dbts_ABVFP_errorpage.php"); exit; } //insert new record $result = mysql_query($query); if (!$result) { $_SESSION[error] = "There has been a DB problem at line 588: Query=$query".mysql_error().". Please contact support at [EMAIL="info@dbtechnosystems.com"]info@dbtechnosystems.com[/EMAIL]"; mysql_close($db); header("Location: dbts_ABVFP_errorpage.php"); exit; } mysql_close($db); }
Tags: None
-
Leave a comment: