Ask God to guide the wrong line: Php+mysql a simple query validation

Source: Internet
Author: User
Tags mysql code
This is the link MySQL code, the file name is link.php
$link =mysql_connect (sae_mysql_host_m. ': '). Sae_mysql_port,sae_mysql_user,sae_mysql_pass);
mysql_select_db (sae_mysql_db, $link);
mysql_query ("Set names UTF8");
?>
This is the code queried with the SQL statement, the file name is testmysql.php
Include ("link.php");
$name = $_get[' name '];
$ticketid = $_get[' Ticketid ');
$id =$_get[' id '];
$result = mysql_query ("select * from 1 WHERE name = ' $name ' and ticket number = ' $ticketid ' and id number = ' $id '", $link);
while ($row =mysql_fetch_array ($result)) {
echo $row [' name ']. " " . $row [' Ticket number '];
echo "
";
}
Mysql_close ($link);
?>
Warnings given after the run:
Warning:mysql_fetch_array () expects parameter 1 to BES resource, boolean given in query/testmysql.php on line 7


Reply to discussion (solution)

Do the field name in Chinese does not seem very good, all say the seventh line of error, their own judgment bar ~

Mysql_query execution error, check that the SQL statement is correct.

Print under result to see if the resource type

Mysql_query execution error, check that the SQL statement is correct.



I began to suspect that this is the problem, but I use SQL statements in the database software query is right AH!


Mysql_query execution error, check that the SQL statement is correct.



I began to suspect that this is the problem, but I use SQL statements in the database software query is right AH!



Variables are wrapped in {}.
  • 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.