Hi,
I hope someone can help me on this one. The following script:
<?php
include("../includes/include.php");
$connect=new db_open("dnlbweb");
foreach($_POST as $key => $val) { $$key=$val; }
$res=mssql_query("SELECT Titel
FROM indeks
join indholdstyper on
indholdstyper.id=indholdstypeid
WHERE Titel='$titel' AND indholdstyper.DataTypeID=$dt");
if (mssql_num_rows($res) > 0)
echo "<h1><p>Denne titel eksisterer allerede: $titel /
$engTitel</p>";
else {
$dis=(isset($dis))?-1:0;
$oprettet = date('d-m-y');
$query ="INSERT INTO Indeks
(Titel, Ptitel, Beskrivelse,
AnsvarligID, DaligLederID, InstitutionID,
KildeTypeID,
engTitel, engPtitel, engBeskrivelse,
Indholdstypeid, disable, oprettelse)
VALUES (
'$titel', '$ptitel', '$bes',
$ans, $dag, $inst, $kilde,
'$engtitel', '$engptitel', '$engbes',
$itype, $dis, getdate() )";
$res=mssql_query($query) ; //**** Line 24 ****
$res=mssql_query("SELECT ID FROM Indeks WHERE Titel='$titel' AND
Ptitel='$ptitel' ORDER BY id DESC");
list($nyid) = mssql_fetch_row($res);
if (!$slut<' ') mssql_query("UPDATE Indeks SET SlutDato='$slut'
WHERE id=$nyid");
if (!$start <' ') mssql_query("UPDATE Indeks SET
StartDato='$start' WHERE id=$nyid");
mssql_close();
echo "<pre>$query</pre>";
// header("Location:ny_index3.php?id=$nyid&dt=$dt");
}
?>
Produces the following output:
Warning: mssql_query() [http://www.php.net/function.mssql-query]:
message: Invalid column name 'DataTypeID'. (severity 16) in
E:\InetPub\NonFPWebs\DNLB\admin\indeks\ny_index2.php on line 24
Warning: mssql_query() [http://www.php.net/function.mssql-query]: Query
failed in E:\InetPub\NonFPWebs\DNLB\admin\indeks\ny_index2.php on line
24
Warning: mssql_query() [http://www.php.net/function.mssql-query]:
message: Line 1: Incorrect syntax near '='. (severity 15) in
E:\InetPub\NonFPWebs\DNLB\admin\indeks\ny_index2.php on line 28
Warning: mssql_query() [http://www.php.net/function.mssql-query]: Query
failed in E:\InetPub\NonFPWebs\DNLB\admin\indeks\ny_index2.php on line
28
INSERT INTO Indeks
(Titel, Ptitel, Beskrivelse,
AnsvarligID, DaligLederID, InstitutionID,
KildeTypeID,
engTitel, engPtitel, engBeskrivelse,
Indholdstypeid, disable, oprettelse)
VALUES (
'TEST', '', 'VR',
0, 0, 0, 11,
'VDS', '', 'RG',
9, 0, getdate() )
So how does DataTypeID get into it? There used to be a column called
'DataTypeID' in the 'indeks' table, but I dropped it during a major
cleanup operation. If i create the column DataTypeID in 'indeks' without
changing the script, I get the following message:
RAISERROR could not locate entry for error 779069 in sysmessages
Still produced by line 24 in the script.
Anyone got an idea about what is going on???
Regards Henrik Hornemann
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php