当我尝试government-owned
使用下面的 php 脚本插入时,它只插入government
,当我使用 PHPmyAdmin 时,它工作得很好。我的 php 脚本有问题吗?
class database
{
private $config = array(
'host' => 'localhost',
'username' => 'root',
'password' => 'root',
'dbname' => 'yelo'
);
public function dbConnect(){
$dbcnx = @mysql_connect($this->config['host'], $this->config['username'], $this->config['password'])
or die("The site database appears to be down.");
if ($this->config['dbname']!="" and !@mysql_select_db($this->config['dbname']))
die("The site database is unavailable.");
return $dbcnx;
}
}
$connDb = new database;
$connDb->dbConnect();
// I thought this could eliminate the problem
$business_name = mysql_escape_string($_POST['business_name']);
$query = "INSERT INTO business SET biz_name = '$business_name'"
$result = mysql_query($query);
谢谢您的帮助。