I am trying to setup a small admin console on my Windows localhost environment which processes a results table on an as needed basis, and while I have most everything else working, am stumped on the following, and while a solution mentioned in this question seems desirable, I had a hard time understanding what's the script path as I had already provided the host, username, password & database in my MySQLi_CONNECT statement before other working queries. If there's another better way I'd appreciate it.
Essentially I need to update a table with a ranking which I know can be simplified on other SQL platforms, but MySQL only seems to work for me when I use a script variable. Here's a snippet of my code from bb2process.sql:
SET @rank := 0;
update bbdata.bb2 SET PTRANK= @rank:= (@rank+1) ORDER BY PTOTAL DESC
This totally works when I run the script in MySQL query browser, but certainly not when I split the commands and use MySQLi_QUERY individually and the solution I linked to suggests using SHELL_EXEC for running a MySQL script but essentially need a clear example.