时间:2021-07-01 10:21:17 帮助过:4人阅读
"; $sql = "show databases"; //查找某个库是否存在 print("$sql"); $sql_return = mysql_query($sql); echo "$sql_return "; while($row = mysql_fetch_array($sql_return)) { for($i = 0; $i != count($row); ++$i) { printf("%s", $row[0]); echo ""; } } //mysql_select_db('web', $conn); ?>
数据库连接成功 show databases Resource id #4 information_schema information_schema mysql mysql performance_schema performance_schema test test web web
数据库连接成功 show databases Resource id #4 Array ( [0] => information_schema [Database] => information_schema ) Array ( [0] => mysql [Database] => mysql ) Array ( [0] => performance_schema [Database] => performance_schema ) Array ( [0] => test [Database] => test ) Array ( [0] => web [Database] => web )
for($i = 0; $i != count($row); ++$i) { printf("%s", $row[0]); echo ""; }