Solutions for correction and error-php Tutorial

Source: Internet
Author: User
Rentai food, please correct and write it to the client. a function in js: functionsqlUserInfo ($ username, $ password) {$ userstrim ($ username); $ passtrim ($ password); $ connmysql_connect ($ host, $ Rentai food, please correct
A function written to client. js:
JScript code
  // Function sqlUserInfo ($ username, $ password) {$ users = trim ($ username); $ pass = trim ($ password ); $ conn = mysql_connect ($ host, $ users, $ passwords); mysql_select_db ($ database, $ conn); // echo "start connect db"; if (! $ Db) return false; // echo "start query db"; $ query = "SELECT * FROM tb_users WHERE username = '". $ users. "'AND password = '". $ pass. "'"; $ SQL = mysql_query ($ query, $ conn) or die (mysql_error (); if (mysql_num_rows ($ SQL) = 1) return true; else die ("database query failed! "); Return false ;}


Error prompt:

Missing name after. operator


... ELECT * FROM tb_users WHERE username = '". $ users."' AND password = '". $ pass ."'"

---------------------------------------------------- Success
The arrow points to the position behind $ users. I don't understand what went wrong. Correction

------ Solution --------------------
If (! $ Db) // $ db undefined
Return false;
What makes me wonder is that this is the php code and should be placed on the server side.
Why is there a function written to client. js ". Very incomprehensible

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.