我正在尝试使用搜索栏创建一个简单页面,当用户搜索特定字词时,将从Google电子表格中提取数据
var queryString = encodeURIComponent('SELECT A, B, C, D, E,F where A like "%<?php echo $search; ?>%" or B like "%<?php echo $search; ?>%" or C like "%<?php echo $search; ?>%" or D like "%<?php echo $search; ?>%" or E like "%<?php echo $search; ?>%" label A "Sr no", B "Product name", C "Technical name", D "Category", E "Seller Name", F "Price" ');
这适用于
var queryString = encodeURIComponent('SELECT A, B, C, D, E,F where upper(A) like upper("%<?php echo $search; ?>%") or B like upper("%<?php echo $search; ?>%") or C like upper("%<?php echo $search; ?>%") or D like upper("%<?php echo $search; ?>%") or E like upper("%<?php echo $search; ?>%") label A "Sr no", B "Product name", C "Technical name", D "Category", E "Seller Name", F "Price" ');
这不是。只是试图使查询不区分大小写。
我在这里做错了什么?
答案 0 :(得分:1)
看起来您只需要将upper
添加到其余列
您为A列添加了upper(A)
但其余列的不 - B,C,D和&amp; E
即。
B like upper("%<?php echo $search; ?>%")
VS。
upper(B) like upper("%<?php echo $search; ?>%")
问题的第二行
var queryString = encodeURIComponent('SELECT A, B, C, D, E,F where upper(A) like upper("%<?php echo $search; ?>%") or B like upper("%<?php echo $search; ?>%") or C like upper("%<?php echo $search; ?>%") or D like upper("%<?php echo $search; ?>%") or E like upper("%<?php echo $search; ?>%") label A "Sr no", B "Product name", C "Technical name", D "Category", E "Seller Name", F "Price" ');
更改为此...
var queryString = encodeURIComponent('SELECT A, B, C, D, E,F where upper(A) like upper("%<?php echo $search; ?>%") or upper(B) like upper("%<?php echo $search; ?>%") or upper(C) like upper("%<?php echo $search; ?>%") or upper(D) like upper("%<?php echo $search; ?>%") or upper(E) like upper("%<?php echo $search; ?>%") label A "Sr no", B "Product name", C "Technical name", D "Category", E "Seller Name", F "Price" ');