- 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
* mysql select * from student where english between 80 and 90; mysql select name from student where math=89 or math=90 or math=91; mysql select name from student where math in (89,90,91); mysql select * from student where english = 80 and english=90; mysql select * from student where name like 韩%; mysql select * from student where name not like 韩%; * 演示 mysql select * from student order by math; mysql select name , chinese+english+math as 总分 from student order by 总分 desc; mysql select name,math from student where name not like 李% order by math; * 这个有必要画图帮助学员理解.(创建表并测试该程序) 取出数据结果集有四种方式(mysql_fetch_row,,mysql_fetch_assoc, mysql_fetch_array, ,mysql_fetch_object) 区别?如何选择使用问题 区别: 前两个效率相当: mysql_fetch_row从结果集中取得一行作为索引数组 mysql_fetch_assoc 取出关联数组(需要通过列名来取数据) 第三个效率偏低: 因为 mysql_fetch_array从结果集中取得一行作为关联数组和数字数组二者兼有,因此代价高,不推荐使用可用通过print_r 或者 var_dump来测试 第四个一般我们不用:因为我们往往自定义对象来处理: mysql_fetch_object 从结果集中取得一行作为对象 【为了演示这个,我们需要重新安装一次wampserver(前面安装的Mysql5.5.27可以不用删除),为了正确操作wamp的mysql 做一个小的修改: datadir=c:/wampvvv/bin/mysql/mysql5.6.17/data character-set-server=utf8 [这个是增加的] 】 取出结果集中的数据 除了该ppt列举出的案例外:还可以使用如下方法: while(list($id,$name,$passwd)=mysql_fetch_row($result)){ //这里不能使用mysql_fetch_assoc().必须包含索引数组才可以 echo $id.$name,$passwd; } while($row=mysql_fetch_row($result)){ //这里能使用mysql_fetch_assoc(),或者mysql_fetch_array() foreach($row as $val){ echo $val.”-”; } } 举一个案例,写一个函数,该函数接收一个表名,就可以把该表的信息,以表格的形式输出到网页 html head title我的php文件/title meta http-equiv=content-type content=text/html;charset=utf-8/ /head body ?php $conn=mysql_connect(localhost,root,root); if(!$conn){ echo 失败; } mysql_select_db(test,$conn); //资源变量的传递是值传递的方式. function showTab($tableName){ $sql=select * from $tableName; //$sql=“desc $tableName”; //可用 //$sql=“show variables”; //可用 $res=mysql_query($sql); //获取共有多少行 $rows=mysql_num_rows($res); $cols=mysql_num_fields($res); //打印出表头 echo table border=1tr; for($i=0;$i$cols;$i++){ echo th.mysql_field_name($res,$i)./th;
有哪些信誉好的足球投注网站
文档评论(0)