Is there somewhere to set a limit on chars sent to mysql_query

I have a loop which creates many UPDATE statements.

I ask for just one statement from the loop, and it processes fine.

If I have many statements, it doesn’t work.

Yet if I print out the list and put it in to php myadmin the same SQL I am sending to mysql_query processes fine…

My only guess right now is that there is a limit on how much I can send to mysql_query, a setting which I have unknowling low, and yet phpmyadmin by-passes somehow?


mysql_query($update_sql);
print "<p>".$update_sql."</p>";

I am trying to send 16 queries together

eg. UPDATE game_config_buildings,game_config_initial_buildings SET game_config_building_active=‘1’,game_config_building_workers=‘0’,game_config_building_landamount=‘0’,game_config_initial_value=‘4’ WHERE game_config_buildings.version_building_id=game_config_initial_buildings.version_building_id AND game_config_initial_buildings.version_building_id=‘1’ AND game_config_initial_buildings.game_config_id=‘1’;UPDATE game_config_buildings,game_config_initial_buildings SET game_config_building_active=‘1’,game_config_building_workers=‘0’,game_config_building_landamount=‘0’,game_config_initial_value=‘4’ WHERE game_config_buildings.version_building_id=game_config_initial_buildings.version_building_id AND game_config_initial_buildings.version_building_id=‘2’ AND game_config_initial_buildings.game_config_id=‘1’;

You cannot send multiple queries using the mysql_* collection of functions, mysqli_* supports this though with [fphp]mysqli_multi_query[/fphp].

It’s a bit cumbersome though, you could still send them individually though; or even use a transaction.

:slight_smile:

Ah, thanks, that sucks a bit :slight_smile:

Is it worth loading the values and checking them against a form submitted before deciding to UPDATE?
With this case out of the 16 or so items not all of them change, but all are submitted by the form.

By the looks of transaction it would involve a bit more hassle than just running the query several times…

In answer to the question in the topic, there is a limit to the size of a single query, but it’s up there in the megabyte range on most servers and is set in the database’s ini file.