I'm running PHP 3 (and PHP 4 on another server) with Sybase 11.9.2 on the
database server.
I have tried in a number or variations to insert a series of updates and
inserts in the same sybase_query. I build a $query consisting of around
15-20 inserts and updates and call the sybase_query function, everything
works fine and it writes to the database as expected however none of the
sybase_querys after this point are recorded.
For example when I create this string:
$query = "Declare @nonuser_signup_id numeric(10,0)\n";
$query .= "Insert into nonuser_signup (email, firstname, lastname, gender)
values ('$email', '$firstname', '$lastname', '$gender')\n";
$query .= "Select @nonuser_signup_id = @@identity\n";
$query .= "Insert into nonuser_optin (nonuser_signup_id, optin_type_id,
promotion_id, signup_date) values (@nonuser_signup_id, $Free_Stuff, 5,
getdate())\n";
$query .= "Insert into nonuser_optin (nonuser_signup_id, optin_type_id,
promotion_id, signup_date) values (@nonuser_signup_id, $Contests, 5,
getdate())\n";
$query .= "Insert into nonuser_optin (nonuser_signup_id, optin_type_id,
promotion_id, signup_date) values (@nonuser_signup_id, $Surveys, 5,
getdate())\n";
$query .= "Insert into nonuser_optin (nonuser_signup_id, optin_type_id,
promotion_id, signup_date) values (@nonuser_signup_id, $Shopping, 5,
getdate())\n";
$query .= "Insert into nonuser_optin (nonuser_signup_id, optin_type_id,
promotion_id, signup_date) values (@nonuser_signup_id, $Games, 5,
getdate())\n";
$query .= "Insert into user_optin (user_id,optin_type_id,promotion_id)
values ($user_id, 10, 5)\n";
$result = sybase_query($query, $db);
Everything works fine, however when its broken up like this:
$query = "Declare @nonuser_signup_id numeric(10,0)\n";
$query .= "Insert into nonuser_signup (email, firstname, lastname, gender)
values ('$email', '$firstname', '$lastname', '$gender')\n";
$query .= "Select @nonuser_signup_id = @@identity\n";
$query .= "Insert into nonuser_optin (nonuser_signup_id, optin_type_id,
promotion_id, signup_date) values (@nonuser_signup_id, $Free_Stuff, 5,
getdate())\n";
$query .= "Insert into nonuser_optin (nonuser_signup_id, optin_type_id,
promotion_id, signup_date) values (@nonuser_signup_id, $Contests, 5,
getdate())\n";
$query .= "Insert into nonuser_optin (nonuser_signup_id, optin_type_id,
promotion_id, signup_date) values (@nonuser_signup_id, $Surveys, 5,
getdate())\n";
$query .= "Insert into nonuser_optin (nonuser_signup_id, optin_type_id,
promotion_id, signup_date) values (@nonuser_signup_id, $Shopping, 5,
getdate())\n";
$query .= "Insert into nonuser_optin (nonuser_signup_id, optin_type_id,
promotion_id, signup_date) values (@nonuser_signup_id, $Games, 5,
getdate())\n";
$result = sybase_query($query, $db);
$query = '';
$query .= "Insert into user_optin (user_id,optin_type_id,promotion_id)
values ($user_id, 10, 5)\n";
$result = sybase_query($query, $db);
The last insert doesn't work. Is this a bug in PHP or am I overlooking
something? Logically it seems that it should function the same in both
cases.
I should also note that when I break that up into a series of completely
independant queries it works fine too, I can run a series of single inserts
each with their own sybase_query and they all insert fine.
However as you can see in the case above I am using a @@identity which makes
splitting these up into different queries impossible.
Thnaks in advance for any aid.
Ben
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]