作者showsky (小小世界)
看板PHP
标题Re: [请益] 小问题
时间Tue Jul 31 14:35:47 2007
※ 引述《showsky (小小世界)》之铭言:
: ※ 引述《Chouje (~~哇是卡仓~~)》之铭言:
: : 今天在做与资料库连结的小綀习时~程式码如下:
: : ------------------------------------------------------------------------------
: : <html>
: : <body>
: : <?php
: : if (isset($old_name)){
: : $link_ID = mysql_connect("localhost:3306","root");
: 预设PORT就是3306 不需要麻烦这样写
: : mysql_select_db("bc_book");
: : $str = "select * from customers where name='$old_name';";
: SQL语法错误 去掉分号select * from customers where name='$old_name'
$str = "select * from `customers` where `name`='$old_name'";
: : $result = mysql_query($str,$link_ID);
: : mysql_close($link_ID);
: : $record = mysql_fetch_row($result);
: : }
: : ?>
: : 请在下面输入资料後查询:
: : <form action="a.php" method="POST">
: : 姓名:<input type="text" name="old_name">
: : <input type="submit" value="查询!">
: : </form>
: : <?php
: : if (isset($record)){
: : if($record){
: : echo"姓名:".$record[1];
: : echo"职业:".$record[2];}
: : else{echo "查无此人!!";}
: : }
: : ?>
: : </body>
: : </html>
: : 这个时後用网页跑出来时他写了:
: : Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result
: : resource
: : 这样写是表示我要怎麽修改呢??@@~~因为跑不出书上的结果~~>"<
: : 是啥麽原因~刚学不久^^|||~~先谢谢回答的大大们~~^^
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.62.124.117