I am new to php. I am trying to run a loop 5 times. Each time the loop runs I need to run a batch file to refresh a table and test the value of a query. If the query is > 0 (meaning there are records in the table) exit the loop. Otherwise run a different batch file and continue.
Run an exec(batchfile)
SELECT COUNT(item_code) AS ItemCount
ItemCount > 0
yes - exit loop and continue with code
Repeat up to 5 times
If after 5 times, exit loop and run exec(RunRefresh2.bat)
Continue wtih code
A friend helped with some code below but I don't think it is doing exactly what I am trying to do
I don't know which type of loop to run the necessary syntax. Can anyone help?
$sql="SELECT COUNT(item_code) AS ItemCount FROM items";
$stmt = sqlsrv_query( $conn, $sql);