我尝试使用jquery获取数据库值,但它无法正常工作
代码 - final.html:http://pastebin.com/vMy5invc
api.php
<?php
$host = "localhost";
$user = "root";
$pass = "";
$databaseName = "vhc";
$tableName = "users";
$con = mysql_connect($host,$user,$pass);
$dbs = mysql_select_db($databaseName, $con);
$data = array();
$result = mysql_query("SELECT `id`,`name`,`email`,`location` FROM $tableName");
while ( $row = mysql_fetch_row($result) )
{
$data[] = $row;
}
echo json_encode( $data );
?>
答案 0 :(得分:0)
你应该用&#34;。$ tableName替换$ tableName。&#34;
$users=User::whereNotIn('name',['admin'])->pluck('id','name');