Php forms a json statement. how can I remove the preceding sentence! Php source code & lt ;? Php // session & nbsp; startsession_start (); include & nbsp ;". /mobile/SQL. php "; $ con & nbsp; = & nbsp; php forms a json statement. how can I remove the preceding sentence!
Php source code
// Session start
Session_start ();
Include "./mobile/SQL. php ";
$ Con = mysql_connect ($ domain, $ usrnm, $ password );
Mysql_select_db ($ usrnm) or die ('could not select database ');
Mysql_query ("set character set 'utf8 '");
$ Page = $ _ GET ['Page'];
If (! $ Con ){
Echo ("can not connect ");
}
Else {
// 1. login authorization
If ($ page = 'login '){
// 1. read and match user data
$ Usrname = $ _ GET ['usrnm '];
$ Pas = $ _ GET ['Pa'];
// 2. search the database
$ SQL = "select * from mb_usr ";
$ Result = mysql_query ($ SQL) or die ('query failed: '. mysql_error ());
While ($ row = mysql_fetch_array ($ result )){
If ($ row ['usrid'] = $ usrname | $ row ['mail'] = $ usrname | $ row ['phoneno'] = $ usrname) & $ row ['Pa'] = $ pas ){
// 3. allocate the session value to reserve the logon time limit
$ _ SESSION [$ usrname] = $ usrname;
// 4. construct the json format of login
$ JsonArr = Array ('logintype' => $ row ['usrtype '], 'sessionid' => $ usrname, 'usrnm' => $ row ['usrnm '], 'usrid' => $ row ['usrid']);
Echo json_encode ($ jsonArr );
Break;
}
Else {
Echo '{"logintype": "-1 "}';
}
}
}
}
?>
The browser resolves
{"logintype":"0","sessionid":"0","usrnm":"mjc","usrid":"0"}
How can I remove the first line! Share with JSON php:
------ Solution --------------------
This sentence is not enough to be removed from the php page.
------ Solution --------------------
Include "./mobile/SQL. php ";
------ Solution --------------------
It is probably include "./mobile/SQL. php"; file generation. paste it and see it.