PHP Query cannot output results

Source: Internet
Author: User
Tags php error
Action


Public Function login () {

$name =$_post[' name '];
$PSW = $_post[' pwd '];
$login 1= D (' Login ');
$ab = $login 1-> Loginmodel ($name);
Echo $ab;



Model


Public Function Loginmodel ($name) {
$sql = "SELECT * from userlogin where username = ' $name '";
$info =mysql_query ($sql);
$a =mysql_fetch_array ($info);
return $a;


Html


Reply to discussion (solution)

$ab is an array, echo is not. Print_r ($AB); Get what

$ab is an array, echo is not. Print_r ($AB); Get what



Or not output on the page

Does the confirmation program enter the model, public function Loginmodel ($name) {exit;//See if you can quit.

Does the confirmation program enter the model, public function Loginmodel ($name) {exit;//See if you can quit.

Into the
$sql = "SELECT * from userlogin where username = ' $name '";
Echo $sql;

SQL statements can be output on the page
SELECT * from userlogin where username = ' eeee '

$a =mysql_fetch_array ($info);
Var_dump ($a); Post the results

$a =mysql_fetch_array ($info);
Var_dump ($a); Post the results

BOOL (FALSE)

That means you don't have that record in your table.

I put SQL in the database and I can find out the value.

Does the PHP error prompt open? Try the following sentence before executing the query
mysql_query ("Set names UTF8"); If your watch is GBK, change it to GBK.

Does the PHP error prompt open? Try the following sentence before executing the query
mysql_query ("Set names UTF8"); If your watch is GBK, change it to GBK.


No, no, it's not my place, it's wrong.

$sql = "SELECT * from userlogin where username = ' $name '";
mysql_query ("Set names UTF8");
$info =mysql_query ($sql) or Die (Mysql_error ());
$a =mysql_fetch_array ($info);
Var_dump ($a);

What is the result now, to report what is wrong.



$sql = "SELECT * from userlogin where username = ' $name '";
mysql_query ("Set names UTF8");
$info =mysql_query ($sql) or Die (Mysql_error ());
$a =mysql_fetch_array ($info);
Var_dump ($a);

What is the result now, to report what is wrong.

Add this or Die (Mysql_error ()); the SELECT * from userlogin where username = "Access denied for user ' ODBC ' @ ' localhost ' (using P Assword:no)

Feel no link database

Do you have ODBC this user, to verify that both users and passwords are entered correctly.

My MySQL has no password with the TP frame

Feel no link database

I don't know where the problem is.

Do you have ODBC this user, if any, authorized?

Just learned, and I'm not very good at it.

I don't know exactly what the problem is, but it's solved. I wrote it in another way, called the next in the original delete and replaced this is good ....

  • 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.