我正在尝试从一个表中选择一个随机地址并将其添加到另一个表的其中一列中,但它一直说“未选择数据库”
if ($_SESSION[address] == "")
{
$db = @mysql_select_db($db_bitcoins,$connection)
or die(mysql_error());
$sql = "SELECT Count(*) FROM address";
$result = @mysql_query($sql, $connection) or die(mysql_error());
$rnum = mysql_num_rows($result);
$rrr=rand(1,rnum);
$sql = "SELECT * FROM address WHERE id = '$rrr'";
$result = @mysql_query($sql, $connection) or die(mysql_error());
while ($sql = mysql_fetch_object($result)) {
$_SESSION[address] = $sql -> ads;
$db = @mysql_select_db($db_name,$connection)
or die(mysql_error());
$sql = "UPDATE $table_name SET bitaddress = $_SESSION[address] WHERE username = '$user' and password = password('$pass')";
$result = @mysql_query($sql, $connection) or die(mysql_error());
}
}
提前致谢!