#16277 [Opn->Fbk]: Multiple statement in a query cause subsequent queries to fail

From: Date: Sat, 07 Dec 2002 07:52:51 +0000
Subject: #16277 [Opn->Fbk]: Multiple statement in a query cause subsequent queries to fail
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-26962@lists.php.net to get a copy of this message
ID: 16277 Updated by: iliaa@php.net Reported By: rbanks@arel.com.au -Status: Open +Status: Feedback Bug Type: MSSQL related Operating System: NT4 PHP Version: 4.1.2 New Comment: Please try using this CVS snapshot: http://snaps.php.net/php4-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-latest.zip Previous Comments: ------------------------------------------------------------------------ [2002-03-26 08:45:52] hholzgra@php.net RTFBR ;) it is MS SQL, not mySQL ------------------------------------------------------------------------ [2002-03-26 08:01:58] sander@php.net RTM! You can only run one query per call to mysql_query()! ------------------------------------------------------------------------ [2002-03-25 22:49:13] rbanks@arel.com.au I am creating tables and indexes in a few places. To make life a little easier I want to create a table and it's indexes in one go. The following code fails: ---- $queries[0]["query_string"]="CREATE TABLE objects ( [id] integer IDENTITY (1,1) PRIMARY KEY, [type] varchar(16) DEFAULT '' NOT NULL, [object] text, [vtype] varchar(16) DEFAULT '' NOT NULL, [lastchanged] TIMESTAMP); CREATE INDEX objects_lastchanged ON objects (lastchanged);"; $queries[1]["query_string"]="CREATE TABLE nodes ( path varchar(127) DEFAULT '' NOT NULL PRIMARY KEY, parent varchar(127) DEFAULT '' NOT NULL, object numeric(11) DEFAULT '0' NOT NULL, priority numeric(11) DEFAULT '0' NOT NULL );"; while ((list($key, $query)=each($queries)) && (!$error)) { echo $query["query_string"]; $exec=mssql_query($query["query_string"]); } ---- But if I separate out the create index into a separate query it works fine. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=16277&edit=1

« previous php.bugs (#26962) next »