Hi all, I am new to this (programmed on mainframe many years). I created a dropdown selection populated from an SQL table. my problem is if I use mysql_*, the selection is populated and works correct but if I change the mysql_* to mysqli_*, it will not work (I know my connect and slect database work, because i do not go into "or die" part). My coding below:
$intIdField = 'code'; $strNameField = 'name'; $strTableName = 'country'; $strNameOrdinal = 'name'; $strMaskName = 'select country'; $strOrderField = 'name'; $strMethod="ASC"; echo "<select name=\"$strNameOrdinal\">\n"; echo "<option value=\"NULL\">".$strMaskName."</option>\n"; $strQuery = "select $intIdField, $strNameField from $strTableName order by $strOrderField $strMethod"; if (!$strQuery) { die("query failed:" . mysql_error()); } echo mysql_query ("set character_set_results='utf8'"); $rsrcResult = mysql_query($strQuery); while($arrayRow = mysql_fetch_assoc($rsrcResult)) { echo $row["name"]; echo $row["code"]; $strA = $arrayRow["$intIdField"]; $strB = $arrayRow["$strNameField"]; echo "<option value=\"$strA\">$strB</option>\n"; } echo "</select>";
It only populates the block with "select country" but if you click on the down arrow, notyhing comes up. as I say, the above coding work but as soon as I change to mysqli, it does not, what am I doing wrong?
Thank you in advance