<script>ec(2);</script>
我程序里要用到PHP连接到MYSQL,所以先要将已经复制到c:windows 下的 php.ini 中看看。
将 extension=php_mysql.dll 前面的 ; 分号给去掉.
phpexe php_mysql.dll 的文件, 也复制到 c:windows, 或者是 path 路径中已经设置好的地方。
然后。可以用下面的一段代码来测试下,是否正常连接了。
本机环境: mysql-4.1.22-win32
MYSQL : root 口令123
数据库:deepthroat
能正常显示了,那就OK
php
// 连接,选择数据库
$link = mysql_connect(''localhost'', ''root'', ''123'')
or die(''Could not connect: '' . mysql_error());
echo ''Connected successfully'';
mysql_select_db(''deepthroat'') or die(''Could not select database'');
// 执行 SQL 查询
$query = ''SELECT * FROM dt_menu'';
$result = mysql_query($query) or die(''Query failed: '' . mysql_error());
// 用 HTML 显示结果
echo " ";
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo " ";
foreach ($line as $col_value) {
echo " $col_value | ";
}
echo "
";
}
echo "
";
// 释放结果集
mysql_free_result($result);
// 关闭连接
mysql_close($link);
?>
Stellungnahme:Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn