如何工作搜索查询喜欢或喜欢和状态

时间:2016-08-29 08:47:26

标签: php mysqli

如果我在mysql查询t_name中搜索多个关键字,例如'%key%'或者t_name喜欢'%key%'然后我想过滤游览状态是1然后只显示哪个在数据库中有1个状态 每件事都有效但AND状态=' 1'不工作
以下是我的查询代码:

   $(function() {
      Highcharts.getSVG = function(chart, text) {
        var svgArr = [],
          top = 0,
          width = 0,
          txt;
        var svg = chart.getSVG();
        svg = svg.replace('<svg', '<g transform="translate(0,' + top + ')" ');
        svg = svg.replace('</svg>', '</g>');

        top += chart.chartHeight;
        width = Math.max(width, chart.chartWidth);

        svgArr.push(svg);
        txt = '<text x= "' + 0 + '" y = "' + (top + 20) + '" styles = "' + text.attributes.style.value + '">' + $(text).val() + '</text>';
        top += 200;
        console.log(txt.indexOf('\n'))
        svgArr.push(txt);
        return '<svg height="' + top + '" width="' + width + '" version="1.1" xmlns="http://www.w3.org/2000/svg">' + svgArr.join('') + '</svg>';
      };
      Highcharts.getSVG = function(chart, text) {
        var svgArr = [],
          top = 0,
          width = 0,
          txt;
        var svg = chart.getSVG();
        svg = svg.replace('<svg', '<g transform="translate(0,' + top + ')" ');
        svg = svg.replace('</svg>', '</g>');

        top += chart.chartHeight;
        width = Math.max(width, chart.chartWidth);

        svgArr.push(svg);
        txt = '<text x= "' + 0 + '" y = "' + (top + 20) + '" styles = "' + text.attributes.style.value + '">' + $(text).val() + '</text>';
        top += 200;
        console.log(txt.indexOf('\n'))
        svgArr.push(txt);
        return '<svg height="' + top + '" width="' + width + '" version="1.1" xmlns="http://www.w3.org/2000/svg">' + svgArr.join('') + '</svg>';
      };

      Highcharts.exportChartWithText = function(chart, text, options) {

        // Merge the options
        options = Highcharts.merge(Highcharts.getOptions().exporting, options);

        // Post to export server
        Highcharts.post(options.url, {
          filename: options.filename || 'chart',
          type: options.type,
          width: options.width,
          svg: Highcharts.getSVG(chart, text)
        });
      };
     Highcharts.exportChartWithText = function(chart, text, options) {

        // Merge the options
        options = Highcharts.merge(Highcharts.getOptions().exporting, options);

        // Post to export server
        Highcharts.post(options.url, {
          filename: options.filename || 'chart',
          type: options.type,
          width: options.width,
          svg: Highcharts.getSVG(chart, text)
        });
      };



      chart = new Highcharts.Chart({
        chart: {
          renderTo: 'container',
          type: 'column'
        },
        title: {
          text: 'Stacked bar chart'
        },
        xAxis: {
          categories: ['PreviousMonthutilizationforCPU', 'CurrentMonthUtilizationforCPU', 'Week2', 'Week2', 'Week3', 'Week4']
        },
        yAxis: {
          min: 0,
          title: {
            text: 'POD'
          }
        },
        tooltip: {
          formatter: function() {
            return '<b>' + this.x + '</b><br/>' +
              this.series.name + ': ' + this.y + '<br/>' +
              'Total: ' + this.point.stackTotal;
          }
        },
        legend: {
          reversed: true
        },
        plotOptions: {
          series: {
            stacking: 'normal'
          }
        },

        series: [{
          data: [1, 2, 3, 3, 4]
        }],

        exporting: {
          enabled: true
        }
      });

       chart = new Highcharts.Chart({
        chart: {
          renderTo: 'container1',
          type: 'column'
        },
        title: {
          text: 'Stacked bar chart'
        },
        xAxis: {
          categories: ['PreviousMonthutilizationforCPU', 'CurrentMonthUtilizationforCPU', 'Week2', 'Week2', 'Week3', 'Week4']
        },
        yAxis: {
          min: 0,
          title: {
            text: 'POD'
          }
        },
        tooltip: {
          formatter: function() {
            return '<b>' + this.x + '</b><br/>' +
              this.series.name + ': ' + this.y + '<br/>' +
              'Total: ' + this.point.stackTotal;
          }
        },
        legend: {
          reversed: true
        },
        plotOptions: {
          series: {
            stacking: 'normal'
          }
        },

        series: [{
          data: [1, 2, 3, 3, 4]
        }],

        exporting: {
          enabled: true
        }
      });


      var text = document.getElementById('txt');

      $("#export2pdf").click(function() {
        Highcharts.exportChartWithText(chart, text, {
          type: 'application/pdf',
          filename: 'wow-pdf'
        });
      });
       $("#export2pdf").click(function() {
        Highcharts.exportChartWithText(chart, text, {
          type: 'application/pdf',
          filename: 'wow-pdf'
        });
      });
    });

任何机构都可以提供帮助,请回复

1 个答案:

答案 0 :(得分:0)

如果您想将电子邮件添加为数组,那么在将变量声明为数组后,您应该首先将变量数组设为$email= array();,然后添加$email = $_POST['email'];