我收到此错误:
在非对象
上调用成员函数fetch_assoc()
当我使用此代码时:
$sql = ('select '.$metric1.' as t1metric from '.$table1.' t1 WHERE '.$date1.' between ('.$start_date.' AND '.$end_date.')');
但是当我使用它时它会起作用:
$sql = ("select t1.clicks as t1clicks from aaa t1 WHERE t1.date between ('2015-11-11 and '2015-11-10')");
我首先认为这是一个问题,不同的引号“和'但我被证明是错误的。
这是我的完整代码:
$servername = 'XXXXX';
$username = 'XXXXX';
$password = 'XXXXX';
$dbname = 'XXXXX';
$table1 = 'aaa';
$table2 = 'bbb';
$metric1 = 'clicks';
$metric2 = 'clicks';
$date1 = 'date';
$date2 = 'date';
$start_date = '2015-11-10';
$end_date = '2015-11-11';
$Db = mysqli_init();
$Db->options(MYSQLI_OPT_LOCAL_INFILE, true);
$Db->real_connect($servername, $username, $password, $dbname, 3306);
// Creation of SQL query
$sql = ("select t1.date, t1.clicks as t1clicks , t2.clicks as t2clicks from aaa t1, bbb t2 WHERE t1.date = t2.date AND t1.clicks != t2.clicks group by date");
// Run the query
$query = $Db->query($sql);
//
while ($row = $query->fetch_assoc())
{
echo sprintf("date: %s, aaa: %s, bbb: %s \n", $row['date'], $row['t1clicks'], $row['t2clicks']);
}
答案 0 :(得分:1)
您收到错误的原因是您没有用引号包装日期。
<View>
{_.map(this.state.ambiences, (id) => {
var image = require('../../assets/img/ambiances/icons/' + label + '.png'); // variable label equals "chic" here
var image2 = require('../../assets/img/ambiances/icons/chic.png');
return <Image style={styles.pastilleOverlay} source={image} />;
})}
</View>
会工作的。
希望这有帮助!
干杯!