需要帮助格式化 mySQL 查询字符串。以下查询返回“解析错误,需要 T_STRING 或 T_VARIABLE”
PHP:
<?php
include 'db_connect.php';
mysql_select_db($databaseName, $con);
$query = "SELECT * FROM .$_POST['tab']. WHERE plant_code = .$_POST['plant_code']";
$result = mysql_query($query) or die (mysql_error());
$row = mysql_fetch_assoc($result);
echo json_encode($row);
?>
jQuery:
$('#profiles_desktops').click(function(){
$.post("php/loadProfile.php", {plant_code : selectedSite, tab : "profiles_desktops"}, function(result){ (do something here...) }); });