0

我想知道是否有人可以解释这一点:我正在尝试将 php 转换为 SQL,但它一直在失败。我在密码领域缺少什么吗?我应该输入什么?

define('DB_HOST',"localhost");
define('DB_USER', (preg_match("/url.co.cc/i",$_SERVER["SERVER_NAME"])?"databaseName":"databaseUser"));
define('DB_PASS', (preg_match("/url.co.cc/i",$_SERVER["SERVER_NAME"])?"password":"password"));
define('DB_NAME', (preg_match("/url.co.cc/i",$_SERVER["SERVER_NAME"])?"databaseName":"databaseUser"));
4

1 回答 1

1

我认为你做错了,试着像这样实现它:

<?php
$username = "your_name";
$password = "your_password";
$hostname = "localhost"; 

//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password) 
  or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
?>
于 2014-09-07T13:49:21.490 回答