Read the list of categories that can be selected from the database

zhaozj2021-02-16  48

Read the list of categories that can be selected from the database

function getUserTypeName ($ intId) {return $ this-> Id2Name ( "user_type", "utf_name", "utf_id", $ intId);} function getUserType ($ strListType, $ strListName, $ strSelected, $ strWhere) {return $ this -> Gethtmlcode ("User_Type", "UTF_NAME", "UTF_ID", $ STRLISTTTTYPE, $ StrlistName, $ STRSELECTED, $ Strwhere);}

// Get the HTML code to display the last function getHtmlCode ($ strTable, $ strTextField, $ strvalueField, $ strListType, $ strListName, $ strSelected, $ strWhere) {global $ strConn; $ strResult = ""; $ strSql = "select" IF ($ strValuefield! = ") $ Strsql. = $ Strsql.", "; $ Strsql. = $ StrTextField." From ". $ StrTable; if ($ strwhere! =") {$ Strsql. = " $ strwhere;} $ strsql. = "ORDER BY". $ strTextField. "ASC"; $ r = mysql_query ($ strsql); while ($ = mysql_fetch_Array ($ r)) {ix ($ strlisttype == "option") {$ Strresult. = " STRINSTR ($ strslected, $ line [$ strairs)) {$ strresult. = "SELECTED";}} else {IF ($ this-> Strinstr ($ strslected, $ strs-worth) Line [$ strRTextField])) {$ strresult. = "SELECTED";}} $ strresult. = ">" $ strresult. = $ line [$ strresult. = "";} else { $ Strresult. = " Strinstr ($ strselected, $ line [$ strresult)) {$ Strresult. = "Checked";}} $ strresult. = "> $ Strresult. = $ Line [$ strtextfield];}}} Return $ strresult;} // Determine if a string is included in a comma or semicolon-separated character Function Strinstr ($ Strlong, $ STRSHORT) {IF (StrPos ($ strlong, ")> 0 || StrPos ($ strlong,"; ")> 0) {ix ($ strlong,", " )> 0) {$ strlong, ",");} else {$ arrstrlong = split ($ strlong, ";");} for ($ i = 0; $ i <= ubound ($ arrstrlong $ I ) {IF ($ arrstrlong [i]) == TRIM ($ strshort)) {$ boorell = true; break;} else {$ booresult = false;}}} else {IF ($ Strlong! = "" && $ strshort! = "") {IF ($ strlong == $ strshort) {$ boorell = true;} else} else {$ booresult = false;}} return = false;}} returnome }

// convert a ID number into the corresponding name Function ID2Name ($ STRTABLE, $ STRNAMEFIELD, $ Stridfield, $ intid) {global $ strconn; $ strsql = "select". $ Strnamefield. "From". $ StrTable. "Where "$ Stridfield." = "$ Intid." ORDER BY ". $ StridField." DESC LIMIT 0, 1 "; // Echo $ strsql; $ r = mysql_query ($ strsql) OR Die (" Invalid Query: " . Mysql_error ()); if ($ line = mysql_fetch_array ($ strresult = $ line [0];} else {$ strresult = false;}}}}}}}?>

转载请注明原文地址:https://www.9cbs.com/read-21352.html

New Post(0)