Page 1 of 1

Problem inserting into table ????

Posted: Wed Feb 26, 2003 5:38 am
by Skywalker
This is ther error I get.
Unknown column 'zoek2' in 'field list'

My source code, I couldn't find enything that was wrong?

Code: Select all

<?php require_once('Connections/verbinding.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
&#123;
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) &#123;
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  &#125;
  return $theValue;
&#125;

$editFormAction = $HTTP_SERVER_VARS&#1111;'PHP_SELF'];
if (isset($HTTP_SERVER_VARS&#1111;'QUERY_STRING'])) &#123;
  $editFormAction .= "?" . $HTTP_SERVER_VARS&#1111;'QUERY_STRING'];
&#125;

if ((isset($HTTP_POST_VARS&#1111;"MM_insert"])) && ($HTTP_POST_VARS&#1111;"MM_insert"] == "form1")) &#123;
  $insertSQL = sprintf("INSERT INTO nieuw (Firmanaam, Adres, Postcode, Plaats, Geslagt, Voorletters, Naam, Telefoon, Fax, Email, Url, Omschrijving, Trefwoorden, Pakket, Ilse, Vindex, Zoek, Scoot, Dolfijn, Altavista, zoek2, Telefoongids, Lycos, Google, Excite, Goudengids, int_Altavista, int_Yahoo, int_Google, int_Aol, int_Hotbot, Int_Msn) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($HTTP_POST_VARS&#1111;'Firmanaam'], "text"),
                       GetSQLValueString($HTTP_POST_VARS&#1111;'Adres'], "text"),
                       GetSQLValueString($HTTP_POST_VARS&#1111;'Postcode'], "text"),
                       GetSQLValueString($HTTP_POST_VARS&#1111;'Plaats'], "text"),
                       GetSQLValueString($HTTP_POST_VARS&#1111;'Geslagt'], "text"),
                       GetSQLValueString($HTTP_POST_VARS&#1111;'Voorletters'], "text"),
                       GetSQLValueString($HTTP_POST_VARS&#1111;'Naam'], "text"),
                       GetSQLValueString($HTTP_POST_VARS&#1111;'Telefoon'], "text"),
                       GetSQLValueString($HTTP_POST_VARS&#1111;'Fax'], "text"),
                       GetSQLValueString($HTTP_POST_VARS&#1111;'Email'], "text"),
                       GetSQLValueString($HTTP_POST_VARS&#1111;'Url'], "text"),
                       GetSQLValueString($HTTP_POST_VARS&#1111;'Omschrijving'], "text"),
                       GetSQLValueString($HTTP_POST_VARS&#1111;'Trefwoorden'], "text"),
                       GetSQLValueString($HTTP_POST_VARS&#1111;'Pakket'], "text"),
                       GetSQLValueString(isset($HTTP_POST_VARS&#1111;'Ilse']) ? "true" : "", "defined","'Y'","'N'"),
                       GetSQLValueString(isset($HTTP_POST_VARS&#1111;'Vindex']) ? "true" : "", "defined","'Y'","'N'"),
                       GetSQLValueString(isset($HTTP_POST_VARS&#1111;'Zoek']) ? "true" : "", "defined","'Y'","'N'"),
                       GetSQLValueString(isset($HTTP_POST_VARS&#1111;'Scoot']) ? "true" : "", "defined","'Y'","'N'"),
                       GetSQLValueString(isset($HTTP_POST_VARS&#1111;'Dolfijn']) ? "true" : "", "defined","'Y'","'N'"),
                       GetSQLValueString(isset($HTTP_POST_VARS&#1111;'Altavista']) ? "true" : "", "defined","'Y'","'N'"),
                       GetSQLValueString(isset($HTTP_POST_VARS&#1111;'zoek2']) ? "true" : "", "defined","'Y'","'N'"),
                       GetSQLValueString(isset($HTTP_POST_VARS&#1111;'Telefoongids']) ? "true" : "", "defined","'Y'","'N'"),
                       GetSQLValueString(isset($HTTP_POST_VARS&#1111;'Lycos']) ? "true" : "", "defined","'Y'","'N'"),
                       GetSQLValueString(isset($HTTP_POST_VARS&#1111;'Google']) ? "true" : "", "defined","'Y'","'N'"),
                       GetSQLValueString(isset($HTTP_POST_VARS&#1111;'Excite']) ? "true" : "", "defined","'Y'","'N'"),
                       GetSQLValueString(isset($HTTP_POST_VARS&#1111;'Goudengids']) ? "true" : "", "defined","'Y'","'N'"),
                       GetSQLValueString(isset($HTTP_POST_VARS&#1111;'int_Altavista']) ? "true" : "", "defined","'Y'","'N'"),
                       GetSQLValueString(isset($HTTP_POST_VARS&#1111;'int_Yahoo']) ? "true" : "", "defined","'Y'","'N'"),
                       GetSQLValueString(isset($HTTP_POST_VARS&#1111;'int_Google']) ? "true" : "", "defined","'Y'","'N'"),
                       GetSQLValueString(isset($HTTP_POST_VARS&#1111;'int_Aol']) ? "true" : "", "defined","'Y'","'N'"),
                       GetSQLValueString(isset($HTTP_POST_VARS&#1111;'int_Hotbot']) ? "true" : "", "defined","'Y'","'N'"),
                       GetSQLValueString(isset($HTTP_POST_VARS&#1111;'Int_Msn']) ? "true" : "", "defined","'Y'","'N'"));

  mysql_select_db($database_verbinding, $verbinding);
  $Result1 = mysql_query($insertSQL, $verbinding) or die(mysql_error());
&#125;

Posted: Wed Feb 26, 2003 5:46 am
by twigletmac
It's telling you that zoek2 is not a column in your table. Check your table, check the case - should it maybe be Zoek2?

On a totally side note I can't say I'm impressed by Dreamweaver's PHP code generation.

Mac

Posted: Wed Feb 26, 2003 10:37 am
by Skywalker
Duh, easy to work with, but still notepad is the best :D