select VERSION()
当前$res=mysql_query("select VERSION()")$row=mysql_fetch_row($res)这样的形式调用SQL查询来获取。
如果查询PHP自身安装的MYSQL支持库(CLIENT)的版本,可以用<?php phpinfo()?>
更为简便的方法使用PHP自带函数mysql_get_server_info()
首先你要看php.ini有没有开启mysql的拓展函数库,然后mysql_connect()连接数据库,mysql_query("set names utf8")设置编码格式,然后mysql_select_db()设置查询的数据库mysql_query()执行sql语句,mysql_fetch_array()或者mysql_fetch_assoc()或者mysql_fetch_num()获取结果集,mysql_close()最后关闭数据库连接,明白了么
$row=
mysql_fetch_row($result)
结果集中取得一行作为枚举数组
$row
=
mysql_fetch_assoc($result)
从结果集中取得一行作为关联数组
你的($row['title']))取了关联索引
改成mysql_fetch_assoc($result)就可以了
不然就是这样:
while
($row
=
mysql_fetch_row($result))
{
echo
'<p><strong>'.($i+1).'.
Title:
'
echo
htmlspecialchars(stripslashes($row[0]))
echo
'</strong><br
/>Author:
'
echo
stripslashes($row[1])
echo
'<br
/>ISBN:
'
echo
stripslashes($row[2])
echo
'<br
/>Price:
'
echo
stripslashes($row[3])
echo
'</p>'
$i++
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)