<?
mysql_connect() /*连接数据库,用户名和密码自行修改*/
or die("无法连接数据库,请重试");mysql_select_db("data1")
or die("无法选择数据库,请重试");
$today=date("Y-m-d H:i:s");$query="
select id
from tb1
where name='$idx' and password='$text' /*从数据库中搜索和登录用户相应的资料*/
";.......
运行时说无法连接到数据库,这个市为什么啊?明明数据库是存在的阿!
mysql> use data1
Database changed
mysql> show tables;
+-----------------+
| Tables_in_data1 |
+-----------------+
| tb1 |
+-----------------+
1 row in set (0.00 sec)mysql> select * from tb1;
+------+------+
| idx | text |
+------+------+
| 1 | 哈哈 |
| 2 | 我们 |
+------+------+
2 rows in set (0.02 sec)
mysql_connect() /*连接数据库,用户名和密码自行修改*/
or die("无法连接数据库,请重试");mysql_select_db("data1")
or die("无法选择数据库,请重试");
$today=date("Y-m-d H:i:s");$query="
select id
from tb1
where name='$idx' and password='$text' /*从数据库中搜索和登录用户相应的资料*/
";.......
运行时说无法连接到数据库,这个市为什么啊?明明数据库是存在的阿!
mysql> use data1
Database changed
mysql> show tables;
+-----------------+
| Tables_in_data1 |
+-----------------+
| tb1 |
+-----------------+
1 row in set (0.00 sec)mysql> select * from tb1;
+------+------+
| idx | text |
+------+------+
| 1 | 哈哈 |
| 2 | 我们 |
+------+------+
2 rows in set (0.02 sec)
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货