$row = mysql_fetch_array($result);echo $row['id'];输出结果:
1
4
7用什么办法让他变成:1,4,7
1
4
7用什么办法让他变成:1,4,7
解决方案 »
- list和each的问题
- php的全局问题
- You don't have permission to access on this server.
- 为什么用exec执行一个命令时,在脚本内执行不成功,放到服务器命令行就可以了,我在/etc/sudoers也做了配置
- include 用法????有点数迷了!!
- 急啊!!!$dir->rewind报错php4换到php5时出问题!
- 不错的系统:帝国下载系统1.5版演示
- 请教高手:IIS4.0+Win2000+PHP4+SQL7.0的问题。万分感谢!!!
- nginx下thinkPhp怎么按照mvc模式访问?
- 请教PHP正则关于字符串的操作问题
- 兄弟,做了一个网站,大家帮忙提提意见。
- 对自己有用的一段CSS
while($row = mysql_fetch_array($result)){
$str .= $row['id'].',';
}
echo rtrim($str,',');
不行 出错了
Parse error: syntax error, unexpected '=' in
if($_POST['submit1'])
{
$shu = $_POST['shu1'];
$result = mysql_query("SELECT * FROM yjwd WHERE fen='16' ORDER BY RAND() LIMIT $shu");
echo "<h1>一等奖</h1><br>"; echo "<table border='1'>
<tr>
<th>ID</th>
<th>姓名</th>
<th>身份证</th>
<th>联系方式</th>
<th>得分</th>
</tr>"; while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>".$row['id']."</td>";
echo "<td>".$row['name']."</td>";
echo "<td>".$row['card']."</td>";
echo "<td>".$row['phone']."</td>";
echo "<td>".$row['fen']."</td>";
echo "</tr>";
}
echo "</table><br>";
}我想把他变成1,4,7 主要是为了使用UPDATE里的条件id in(1,4,7)来修改一个字段
上面的代码 没问题 主要是我想单独取出个1,4,7
然后用在 update set **** where id in(1,4,7)
while($row = mysql_fetch_array($result))
{
$str .= $row['id'].',';
echo "<tr>";
echo "<td>".$row['id']."</td>";
echo "<td>".$row['name']."</td>";
echo "<td>".$row['card']."</td>";
echo "<td>".$row['phone']."</td>";
echo "<td>".$row['fen']."</td>";
echo "</tr>";
}
echo rtrim($str,',');
这样,我这里都行,为什么你那里不行