Php forms a json statement. how to remove the preceding sentence?

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.