Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2014
    Thanked 0 Times in 0 Posts

    mysql_* versus mysqli_*

    I am new to web programming and I have a little problem I do not understand. I have a drop down selection which works fine when using mysql_* but as soon as I replace the mysql_* with mysqli_* it does not work it only populates the selection box with ‘select country’ but nothing comes up. I know my connect and select database part work because I do not go into the ‘or die’ option. Here is my codeing with mysql_* which work but will not work if changed to mysqli_*
    $intIdField = 'code';
    $strNameField = 'name';
    $strTableName = 'country';
    $strNameOrdinal = 'name';
    $strMaskName = 'select country';
    $strOrderField = 'name';
    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());
    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>";

  2. #2
    Regular Coder Linux_Sage's Avatar
    Join Date
    Mar 2014
    Thanked 10 Times in 10 Posts
    mysql_ functions are deprecated and insecure and will be removed in future revisions of PHP.

    The mysqli_ functions are more up to date and are used a bit differently than the old functions. Look in this to learn how to use them: 'MySQLi' for Beginners - Codular


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts