简体   繁体   中英

PHP MSSQL Query not executing

I have an mssql query in php which does not seem to be executing.

Does anyone have any idea's? When running profiler on SQL, all I see is the database being selected.

$sth = mssql_query("ALTER TABLE " & $tablename & " ADD " & $newfield & " " & $type);

$save = mssql_query("INSET INTO SD_FIELDS (COLUMN_NAME, DISPLAY_NAME, SEQ_TABLE, DATA_TYPE, COLUMN_TYPE)
                        values ('" & $newfield & "', '" & $displayname & "', " & $tableseq & ", '" & $datatype & "', '" & $type & "'");


if ($sth) 
{
    if ($save) 
    {
        $response["success"] = 1;
    } 
    else 
    {
        $response["success"] = 0;
        $response["message"] = $save;
    }
} 
else 
{
     $response["success"] = 0;
     $response["message"] = $sth;
}

Replace & with .

Should be like this: '" . $var . "'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM