Home  >  Q&A  >  body text

When checking whether the column exists, an error is reported

$sql="select count(*) from cat where catname=$cat[catname]";

    $rs=mysql_query($sql);

    if(@mysql_fetch_row($rs)[0]!=0){

    echo "栏目存在";

    exit();

    };


万叶万叶2680 days ago1010

reply all(2)I'll reply

  • SunBoy

    SunBoy2017-06-22 11:13:32

    Post the error message

    reply
    0
  • PHP中文网

    PHP中文网2017-06-22 10:29:53

    $cat[catname] Is this an array? The content in [] should be enclosed in quotation marks

    $sql="select count(*) from cat where catname=$cat['catname']";


    reply
    0
  • Cancelreply