php 7
I have a section in a php script which gathers info from a database. I am not the original author and am fairly new to php. The table in the database goes up to "doc16" however when testing this script I get an error for the following code because "Unidentified index: doc17".
Here is the section giving the error:
$sql="select * from users where username='$userid'";
$result=mysqli_query($info,$sql);
$line1=mysqli_fetch_array($result);
$docname="doc1";
$ptr=1;
while($permission=($line1["$docname"])){
$inquirytable[$ptr]=$permission;
$ptr++;
$docname="doc".$ptr;
}
$info
is the database connection info
In the database the doc#X
for 1-16 is either a yes or no value
I have tried playing with the values of $ptr to to force it to make $docname
= doc16
or doc2
but no matter the value that just causes a Fatal : Allowed memory size
error.
Any direction or assistance is appreciated. I will do my best to provide more information if necessary.
EDIT 1:
using var_dump ($line1["$docname"]);
before my while loop returns
string 'Y' (length=1)