Date: 06/19/01
- Next message: Andi Gutmans: "Re: [PHP-DEV] 4.0.6 - ?"
- Previous message: Paul Moosman: "[PHP-DEV] Sybase query result problem"
- In reply to: Ben Gabrielson: "[PHP-DEV] Multiple inserts in one sybase_query issue"
- Next in thread: Ben Gabrielson: "Re: [PHP-DEV] Multiple inserts in one sybase_query issue"
- Reply: Ben Gabrielson: "Re: [PHP-DEV] Multiple inserts in one sybase_query issue"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Well, what you are doing in the second query is actually getting more
resultsets in one query. The current sybase modules can't handle more
than 1 resultset at a time. Try running sp_help through sybase_query(),
you'll notice that only the first resultset is given back, all the rest
is discarded. I'm thinking already a while about changing this so you
can get an array of resultsets from sybase_query() which would allow you
to do the stuff you're trying to do now..
Any ideas of the group would be appreciated (as i'm not a very good
c-coder anyway)
On Mon, Jun 18, 2001 at 06:01:54PM -0500, Ben Gabrielson wrote:
> 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 <email protected> numeric(10,0)\n";
> $query .= "Insert into nonuser_signup (email, firstname, lastname, gender)
> values ('$email', '$firstname', '$lastname', '$gender')\n";
> $query .= "Select <email protected> = @ <email protected>\n";
> $query .= "Insert into nonuser_optin (nonuser_signup_id, optin_type_id,
> promotion_id, signup_date) values ( <email protected>, $Free_Stuff, 5,
> getdate())\n";
> $query .= "Insert into nonuser_optin (nonuser_signup_id, optin_type_id,
> promotion_id, signup_date) values ( <email protected>, $Contests, 5,
> getdate())\n";
> $query .= "Insert into nonuser_optin (nonuser_signup_id, optin_type_id,
> promotion_id, signup_date) values ( <email protected>, $Surveys, 5,
> getdate())\n";
> $query .= "Insert into nonuser_optin (nonuser_signup_id, optin_type_id,
> promotion_id, signup_date) values ( <email protected>, $Shopping, 5,
> getdate())\n";
> $query .= "Insert into nonuser_optin (nonuser_signup_id, optin_type_id,
> promotion_id, signup_date) values ( <email protected>, $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 <email protected> numeric(10,0)\n";
> $query .= "Insert into nonuser_signup (email, firstname, lastname, gender)
> values ('$email', '$firstname', '$lastname', '$gender')\n";
> $query .= "Select <email protected> = @ <email protected>\n";
> $query .= "Insert into nonuser_optin (nonuser_signup_id, optin_type_id,
> promotion_id, signup_date) values ( <email protected>, $Free_Stuff, 5,
> getdate())\n";
> $query .= "Insert into nonuser_optin (nonuser_signup_id, optin_type_id,
> promotion_id, signup_date) values ( <email protected>, $Contests, 5,
> getdate())\n";
> $query .= "Insert into nonuser_optin (nonuser_signup_id, optin_type_id,
> promotion_id, signup_date) values ( <email protected>, $Surveys, 5,
> getdate())\n";
> $query .= "Insert into nonuser_optin (nonuser_signup_id, optin_type_id,
> promotion_id, signup_date) values ( <email protected>, $Shopping, 5,
> getdate())\n";
> $query .= "Insert into nonuser_optin (nonuser_signup_id, optin_type_id,
> promotion_id, signup_date) values ( <email protected>, $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 @ <email protected> 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: php-dev-unsubscribe <email protected>
> For additional commands, e-mail: php-dev-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>
>
-- Jo Giraerts Computerprutser Life BVBA Interleuvenlaan 15A, 3001 LEUVEN, BELGIUM icq:81939849, email:jo <email protected>, ph0ne:+32(0)16 20 89 61I've got these opium queens that move around my space, I said it's waste not, want not, I think I'll take another, I'm holding all this pain that I'm trying to smother. <branvan3000 - Afrodisiac>
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Andi Gutmans: "Re: [PHP-DEV] 4.0.6 - ?"
- Previous message: Paul Moosman: "[PHP-DEV] Sybase query result problem"
- In reply to: Ben Gabrielson: "[PHP-DEV] Multiple inserts in one sybase_query issue"
- Next in thread: Ben Gabrielson: "Re: [PHP-DEV] Multiple inserts in one sybase_query issue"
- Reply: Ben Gabrielson: "Re: [PHP-DEV] Multiple inserts in one sybase_query issue"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

