PHP: Extracting data from a SQL generated array
I'm quite new to PHP and experiencing some issues.
I understand programming in general as I have been using ASP for quite some time.
I am trying to get a record from a database using an sql lookup (sql1). This then returns as an array which is fine, but I need to use part of the array for my next stage.
My question is, does anyone know how to remove a fields value from the array?
My code is:
As you can see, I tried to use this: $opt["subjectid"] as subjectid is the fieldname that I am trying to access and I was under the impression that this was correct for accessing an array, but I get the following error:
//Diags for SQL content
$n = count($opt);
echo 'No options selected';
$optno = $opt["subjectid"];
// Diags of $optno
echo '<br>$optno = '.$optno;
Notice: Undefined index: subjectid
Any thoughts would be much appreciated.