I'm getting the below error in order to achieve passing values to the "select" statement.
Undefined Offset Error on statement
print_r($fieldName[$enID]);
Code looks like
while($row = $result->fetch_assoc())
{
$counter1 = $counter++;
$fieldName[] = $row['fieldName'];
$fieldText[] = htmlspecialchars($row['fieldText']);
$fieldID[] = $row['ID'];
$enID = $row['ID'];
echo "$enID";
print_r($fieldName[$enID]);
//$enfieldText = $mysqli->query("SELECT fieldText FROM languageUpdate WHERE fieldName = '$row["fieldName"]' and Language = 'en'")->fetch_object()->fieldText; ##NEED HELP IN FIXING THIS
if ($_GET['showname']){
echo"<tr>";
echo "<td>".$row['fieldName']."</td>";
echo '<td>'.'<input type = "text" class="form-control" onclick ="colorChange(this)" disabled = "disabled" id ="'.$row["ID"].'" name = "fieldText['.$row["ID"].']" value = "'.$row["fieldText"].'">'."</td>";
echo "</tr>";}
}
My code fetches ID, Name and Text
from database,and what I'm trying to do is to fetch some another data from the same table but by capturing the Name
field extracted earlier. Basically, a nested information is being pulled. I'm getting an undefined offset on line: print_r($fieldName[$enID])
. I'm capturing this in order to pass it to the next line to get one unique value, but I'm not able to do so.
example:
Lets say: while fetching results: $fieldName[] Array ( [0] => title [1] => listHeading )
I'm hoping to extract title, and listHeading
and pass it to the
//$enfieldText = $mysqli->query("SELECT fieldText FROM languageUpdate WHERE fieldName = 'title'")->fetch_object()->fieldText; ##dynamic parameterization
Let me know if it is not clear.