SAE平台,数据库已开启,表格已经建好,希望实现功能:查询字段A包含内容a的记录,返回该记录的字段B值:
代码如下:
<?php
$mysql = new SaeMysql();
echo "Connect success <br/>\n";
$sql = mysql_query("SELECT * FROM `nature` WHERE `name` LIKE \'狼\' LIMIT 0, 30 ");
$data = $mysql->getData($sql);
echo $data['class'];
?>
运行结果为:
Connect success
Warning: mysql_query() [function.mysql-query]: this app is not authorised in index.php on line 5
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in index.php on line 5
Warning: mysqli_query() [function.mysqli-query]: Empty query in saemysql.class.php on line 191
请问下各位大大,是错在哪呢?
------解决思路----------------------
$sql = "SELECT * FROM `nature` WHERE `name` LIKE '%狼%' LIMIT 0, 30 ";