Jump to content

ptanewbe

New Members
  • Posts

    1
  • Joined

  • Last visited

ptanewbe's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.