Hello. I understand that the matter is in some quotes, but I don’t know how to fix this problem. Here is my php code:

$link = db_connect(); $query = "set @today:=date('2016-12-11'); update main M join ( select cid, nomer from ( select A.nomer, @cstart:=if(@cnum=A.nomer,@cstart,A.start), @cnum:=A.nomer, @cid:=(select M.id from main M,allnomer MT where MT.nomer=M.numbernomer and MT.type='lux' and M.datestart>@cstart and find_in_set(M.id,@used)=0 order by datestart limit 1 ) cid, @cstart:=(select dateend from main where id=@cid) dend, @used:=coalesce(concat(@used,',',@cid),@used) from ( select A.nomer, A.start from ( select A.nomer, (select coalesce(min(dateend),@today-interval 1 day) from main M where datestart<=@today and M.numbernomer=A.nomer) start from allnomer A where type='lux' ) A, main M, allnomer MT where MT.nomer=M.numbernomer and MT.type='lux' and M.datestart>A.start order by A.start desc, A.nomer ) A, (select @cid:=0,@cnum:=0,@cstart:=NULL,@used:='') Y ) X where cid is not null ) U on M.id=U.cid set M.numbernomer=U.nomer"; $result = mysqli_query($link, $query); var_dump($result); 

A bool is returned to me (false) and no changes are made to the database. If I run the same request through phpmyadmin, then everything will work and the request will be executed. This is clearly a quotation, for the usual SELECT works without problems. What needs to be corrected, so that the request goes to the database?

  • one
    $result = mysqli_query($link, $query) or exit(mysqli_error($link)); What error will bring? - Visman
  • I have a multi request. query does not process multi requests. - firebear

1 answer 1

 $result = mysqli_multi_query($link, $query); 

In mysqli_query it is impossible to thrust several requests.