Location: PHPKode > scripts > MySQL/HTML-Client > mysqlhtml-client/modules/edit.inc.php
<?php   
    if ($radio_name == "new" || !$radio_name)
    {
        $query_text = "SELECT * FROM " . $table . " LIMIT 0";
    }    
    else 
    {
        if ((strstr($primary_key_field, "__")) && (strstr($radio_name, "__"))) {
            $primary_key_field_array = explode("__", $primary_key_field);
            $radio_name_array = explode("__", $radio_name);
            $query_text = "SELECT * FROM " . $table . " WHERE";
            for ($i = 0; $i < sizeof($primary_key_field_array); $i++) {
                $query_text .= " " . $primary_key_field_array[$i] . "=\"" . $radio_name_array[$i] . "\"";
                if ($i < sizeof($primary_key_field_array)-1)
                    $query_text .= " AND";
            }
        } else {
            $query_text = "SELECT * FROM " . $table . " WHERE " . $primary_key_field . "=\"" . $radio_name . "\"";
        }
    }
    
    $result = mysql_db_query($database, $query_text, $db_link) or mysql_client_error_msg($query_text, __FILE__, __LINE__);
    $myrow = mysql_fetch_array($result, MYSQL_NUM);
    $fieldcounts = mysql_num_fields($result);
    echo "<table width=\"750\" border=\"0\" align=\"left\" cellspacing=\"0\" cellpadding=\"0\">\n";
    $fieldnames_array = array();
    for($i = 0; $i < $fieldcounts; $i++) {
        $edit_field = mysql_fetch_field($result, $i);        
        $field_len = mysql_fieldlen($result, $i);
        echo "<tr bgcolor=\"#345678\"><td class=\"white\"><b>" . $edit_field->name . "</b> [" . $edit_field->type . "(" . $field_len . ")]";
        echo "</td>";
        echo "<td class=\"white\" align=\"right\">";
        echo "&nbsp;<input " . $style2 . " type=\"checkbox\" name=\"quotes[" . $i . "]\" value=\"" . $i . "\" checked>&nbsp;Field enclosed by <b>&quot;&quot;</b>";
        echo "</td>";
        echo "</tr>\n";         
        echo "<tr><td class=\"white\" colspan=\"2\">";
        if ($field_len < 80) {
            echo "<input type=\"text\" name=\"textarea[]\" size=\"" . $field_len . "\" value=\"" . htmlspecialchars($myrow[$i]) . "\" size=\"" . $field_len . "\">";   
        } else {
            echo "<textarea rows=\"";
            if ($field_len < 1000)
            {
                $rows = round($field_len / 80);
            }
            else
            {
                $rows = 10;
            }
            if ($rows == 0)
            {
                $rows = 1;
            }
            echo round($rows) + 1;
            echo "\" cols=\"80\" name=\"textarea[]\">" . htmlspecialchars($myrow[$i]);
            echo "</textarea>\n";
        }
        echo "</td></tr>\n";            
        $fieldnames_array[$i] = $edit_field->name;
    }
    $fieldnames = implode("#", $fieldnames_array);
    echo "</table><br clear=\"all\"><br>";
    if ($radio_name=="new") {
        echo "\n<input type=\"button\" class=\"button\" name=\"myaction\" value=\"insert\" onClick=\"promptMyAction(this.value, 0)\">";
    } else {
        echo "\n<input type=\"button\" class=\"button\" name=\"myaction\" value=\"update\" onClick=\"promptMyAction(this.value, 1)\">";
        echo "\n<input type=\"button\" class=\"button\" name=\"myaction\" value=\"insert as new row\" onClick=\"promptMyAction(this.value, 1)\">";
    }       
?>
<input type="hidden" name="count_fields" value="<?php echo $fieldcounts; ?>">
<input type="hidden" name="fieldnames" value="<?php echo $fieldnames; ?>">
<input type="hidden" name="radio_name" value="<?php echo $radio_name; ?>">
Return current item: MySQL/HTML-Client