Mysql_fetch_array () function is always running unsuccessfully, ask for answers

Source: Internet
Author: User
Mysql_fetch_array () function is always running unsuccessfully, ask for answers

Include ('.. /webshop_sql_con.php ');
if (isset ($_get[' search ')) {
$search =$_get[' search ';
$query = "SELECT * from Obj_info WHERE obj_name like '%search% ' ORDER by Obj_sale DESC";
if ($result =mysql_query ($query, $dbc)) {
while ($row =mysql_fetch_array ($result)) {
Print
  • '. $row [' Obj_name ']. '

    Price: '. $row [' Obj_pri ']. '

    < li="">';

    }

    }
    Database connection file has been written, the other search is the result of this write can be returned, this is always wrong, and I tried Var_dump ($row), the result is false. What do you mean?
    In the graduation design, PHP is also just contact, trouble mobile sister advice AH
    ------Solution--------------------
    There are no records in the table that contain search words
    Maybe what you need is
    $query = "SELECT * from Obj_info WHERE obj_name like '%$search% ' ORDER by Obj_sale DESC";
    ------Solution--------------------
    Same as 2 floor $query = "SELECT * from Obj_info WHERE obj_name like '%$search% ' ORDER by Obj_sale DESC";
    Be careful.
    ------Solution--------------------
    Agree to 2 floor, the stitching statement to be careful AH
    ------Solution--------------------
    SQL is incorrectly written.

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