An error occurred while extracting username data containing letters.

Source: Internet
Author: User
An error occurred while extracting username data containing letters. This post was last edited by wuzhi456 from 2015-11-. after a user logs on, I used the following statement to extract the data of the user who has logged on: & lt ;? Php & nbsp; include (IncDB. php); & nbsp; session_start & nbsp; () & nbsp; $ resu error in extracting username data containing letters

This post was last edited by wuzhi456 at 22:21:50

After a user logs on, I use the following statement to extract the data of the logged on User:
Include ("IncDB. php ");
Session_start ();
$ Result = mysql_query ("SELECT * FROM userlinks where id = 'a02' and userid = ". $ _ SESSION ['id']. "order by datetime desc limit 1", $ link );
$ Row = mysql_fetch_row ($ result );
Echo "$ row [1]";
Echo"
";
Echo "$ row [2]";

Mysql_close ($ link );
?>

The problem is that the extracted data can be correctly displayed when a full number of users log on, but if the user name contains letters or Chinese characters, the displayed content is blank and there is nothing; and an error is returned: Warning: mysql_fetch_row (): supplied argument is not a valid MySQL result resource in .... why?

My database and web pages are all coded in UTF-8. The database contains data, not empty. Thank you! I'm going crazy ....
------ Solution ----------------------

$ _ SESSION ['id'] = 'abc123 ';
$ SQL = "SELECT * FROM userlinks where id = 'a02' and userid =". $ _ SESSION ['id']. "order by datetime desc limit 1 ";
Echo $ SQL; // check whether the value of the userid field is enclosed by quotation marks.

------ Solution ----------------------
Userid = '". $ _ SESSION ['id']." 'Order is not acceptable.
Userid = '". $ _ SESSION ['id']." 'Order
Otherwise, an extra space will be missing.

Can I give each two 30?
No, unless you add extra points to the post!

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.