Sadece emin olmak için: Eğer PHP bu 4 sorguları yürütmek için çalışırken, sen mysql_query dört defa diyorsun?
Örneğin:
mysql_query("INSERT INTO um_group_rights (`um_group_id`,`cms_usecase_id`,`um_right_id`) VALUES (2,1,1)");
mysql_query("INSERT INTO um_group_rights (`um_group_id`,`cms_usecase_id`,`um_right_id`) VALUES (2,2,1)");
mysql_query("INSERT INTO um_group_rights (`um_group_id`,`cms_usecase_id`,`um_right_id`) VALUES (2,3,1)");
mysql_query("INSERT INTO um_group_rights (`um_group_id`,`cms_usecase_id`,`um_right_id`) VALUES (2,4,1)");
What I mean is : you cannot send several distinct queries at once, with only one call to mysql_query (quoting, emphasis mine) :
mysql_query() sends a unique query
(multiple queries are not supported) to the currently active
database on the server that's
associated with the specified
link_identifier .
Muhtemelen sana söylemeden phpMyAdmin yaptığı bir şeydir - Siz "ayrı" sorguları var.
Ve, @Alexandre pointed out açıklamalarda olduğu gibi:
The query string should not end with a
semicolon.
If you are using the mysqli_* functions (and not mysql_*) to access your database, you could try using mysqli_multi_query.
Ne yazık ki, mysql_* için böyle bir işlevi vardır.
(BTW: mysql_* API eski biridir - kullanmak için, özellikle yeni bir proje için, daha iyi olurdu mysqli_*)
Edit after the comment :
Bu performansları hakkında ise, evet, bunun yerine dört ardışık PHP <-> MySQL aramaların veritabanına tek bir çağrı yapıyor, daha iyi olabilir.
Bu durumda, aynı anda birkaç satır eklemek sağlayan insert sözdizimi kullanarak deneyebilirsiniz; bkz 12.2.5. INSERT Syntax MySQL kılavuzunda (quoting):
INSERT statements that use VALUES
syntax can insert multiple rows.
To do this, include multiple lists
of column values, each enclosed within
parentheses and separated by commas.
Example:
INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);
The values list for each row must be
enclosed within parentheses.