Elseif ($ keyword & quot; performance query & quot;) {$ msgType & quot; text & quot; $ contentStr & quot; enter your student ID & quot ;; $ resultStrsprintf ($ textTpl, $ fromUsername, $ toUsername, $ time, $ msgType, $ contentStr);} elseif (is_numeric ($ keyword) {if (strlen ($ keyword) 7) {mysqlsae
Elseif ($ keyword = "performance query ")
{
$ MsgType = "text ";
$ ContentStr = "enter your student ID ";
$ ResultStr = sprintf ($ textTpl, $ fromUsername, $ toUsername, $ time, $ msgType, $ contentStr );
} Else if (is_numeric ($ keyword )){
If (strlen ($ keyword) = 7)
{
//////
$ ContentStr = "enter if (strlen ($ keyword) = 7 )";
$ ResultStr = sprintf ($ textTpl, $ fromUsername, $ toUsername, $ time, $ msgType, $ contentStr );
////
$ Con = mysql_connect (SAE_MYSQL_HOST_M. ':'. SAE_MYSQL_PORT, SAE_MYSQL_USER, SAE_MYSQL_PASS); if (! $ Con) {// $ contentStr = "enter if (! $ Con) "; $ resultStr = sprintf ($ textTpl, $ fromUsername, $ toUsername, $ time, $ msgType, $ contentStr); // die ('could not connect: '. mysql_error ();} else {// $ contentStr = "enter else"; $ resultStr = sprintf ($ textTpl, $ fromUsername, $ toUsername, $ time, $ msgType, $ contentStr); // mysql_select_db ("app_cjcx123", $ con); $ query = sprintf ("SELECT * FROM table1 WHERE xm = 1450375 "); $ result = mysql_query ($ que Ry); while ($ row = mysql_fetch_assoc ($ result) {$ contentStr = $ row ['xm ']. $ row ['CJ ']; mysql_close ($ con) ;}} else if (! Is_numeric ($ keyword) {$ msgType = "text"; $ contentStr = "student ID error, please enter"; $ resultStr = sprintf ($ textTpl, $ fromUsername, $ toUsername, $ time, $ msgType, $ contentStr);} else {$ contentStr = "Input something... "; $ resultStr = sprintf ($ textTpl, $ fromUsername, $ toUsername, $ time, $ msgType, $ contentStr) ;}} this is the source code. Added several outputs and stuck to $ con = mysql_connect (SAE_MYSQL_HOST_M. ':'. SAE_MYSQL_PORT, SAE_MYSQL_USER, SAE_MYSQL_PASS); in this sentence, if else is not included in the end. for instructions, we need to define the global variables for several parameters used to connect to the database.