mysql - PHP Open Multiple Connections -
i run multiple scripts instances of same script in different browser tabs. , them have different mysql connections. each unique connection.
i know mysql_connect
has fourth parameter $new_link
should open new link, not open new connection, usually. does.
i have xampp install on widows machine.
the question is: how can absolutely force php/mysql open new connections each instance of script? script runs 2mins.
http://localhost/myscript.php
here excerpts of mysql code. first load work assignment db , mark in progress:
public function loadrange() { try{ $this->db()->query('start transaction'); $this->row = $this->db()->getobject(" select * {$this->tableranges} status = " . self::status_ready_for_work . " , domain_id = {$this->domainid} order sort asc limit 1"); if(!$this->row) throw new exception('could not load range'); $this->db()->update($this->tableranges, $this->row->id, array( 'thread_id' => $this->id, 'status' => self::status_working, 'run_name' => $this->runname, 'time_started' => time(), )); $this->db()->query('commit'); } catch(exception $e) { $this->db()->query('rollback'); throw new exception($e->getmessage()); } }
then script may or may not insert rows in table based on finds.
in end, when task finished, assignment row updated again:
$this->db()->update($this->tableranges, $this->row->id, array( 'status' => self::status_executed, 'time_finished' => time(), 'count' => $count, ));
in particular, $this->tableranges
table looks locked. idea why case? innodb table.
i run multiple scripts instances of same script in different browser tabs. , them have different mysql connections. each unique connection.
this case, without additional effort
the question is: how can absolutely force php/mysql open new connections each instance of script.
answer: nothing :)