我想在php里实现用户资料的随机调用,没有调用范围的限制。不知道应该如何写这段随机代码。
我的数据表主要是 username,userid,grade,sex,photo_s .__TBL_MAIN__. 请各位帅哥哥帮帮小妹
我的数据表主要是 username,userid,grade,sex,photo_s .__TBL_MAIN__. 请各位帅哥哥帮帮小妹
解决方案 »
- 如何做到对应编号导入数据?
- 网站打开不稳定,求真相
- 一个Socket连接发送多个url数据的问题
- php mysql_free_result 的问题
- 关于MYSQL的,高手请进帮帮我吧。。急。。。在线等。
- 为什么需要gd.so
- ThinkPHP ajaxReturn 返回如下格式的json数据,该怎么定义对象
- file_get_content 或 fopen 打开 “http://xxxxxxxxxxx" 时如何设置超时呢?
- 呵,发表一个我写的购物车类,和大家分享一下。。
- 使用dreamweaver打开php文件问题,求大神解答
- 请教下此接链哪个地方有问题
- php如何把图片以二进制流方式存入Mysql中!
再以这个数组的个数为上限生成 int 类型的随即数 比如得到 i
用 数组【i】即可得到 随即的资料id
要不然...怎么帮啊相帮也无能为力啊...
向你说的.随机调用的话简单数据库里设置个主键 然后每个ID有自己的数字ID然后用随机数调出来
比如说 当随机数100的时候调用数字ID100的拥护资料..注意:随机数必须的要有限制哦..
$rt=$db->query("SELECT id,nickname,photo_s FROM ".__TBL_MAIN__." WHERE flag=1 AND photo_s<>'' ORDER BY refresh_time DESC LIMIT 6");
$total = $db->num_rows($rt);
if($total>0){
?>
<table width="778" border="0" cellpadding="2" cellspacing="0" bgcolor="#FFFFFF" style="border:#EDD4F0 1px solid;">
<tr>
<?php
for($i=1;$i<=$total;$i++) {
$rows = $db->fetch_array($rt);
if(!$rows) break;
?>
<td align="center" style="padding-top:10px;padding-bottom:10px;"><table width="50" border="0" cellpadding="2" cellspacing="0" bgcolor="ffffff">
<tr>
<td height="50" align="center" style="border:#dddddd 1px solid;" width="480" height="29"><div class="photo100X75"><a href="<?php echo $Global['home_2domain']; ?>/<?php echo $rows[0]; ?>" target="_blank"> <?php echo "<img src=".$Global['up_2domain']."/photo/".$rows[2]." border=0 >";?> </a></div></td>
</tr>
</table>
<table width="50" height="5" border="0" align="center" cellpadding="0" cellspacing="0" >
<tr>
<td align="center" valign="top"></td>
</tr>
</table>
<a href="<?php echo $Global['home_2domain']; ?>/<?php echo $rows[0]; ?>" target="_blank" class="666666"><?php echo $rows[1];?></a>
<?php if ($i % 6 == 0) {?>
</tr>
<tr>
<?php } ?>
<?php } ?>
</tr>
</table>
<?php }?>