对于我的这个查询,我想不出更好的标题。我正在尝试显示所有用户,然后在每一行中都有一个 VIEW 链接(基于他们的用户 ID)......例如:(http://minquep.com/pages/23
其中 23 是一个用户的用户 ID)......
这也是我的显示功能和删除功能。
我已经使用在每一行中显示了 VIEW 链接
<a href="<? echo $rows['user_id']?>VIEW</a>
我的问题是,VIEW 链接的每个 url 还没有在 pages 文件夹下生成。
如何根据每个用户的 user_ids 在每个用户中创建一个 view.php
当我添加用户时,是否可以创建一个自动查看页面。以及如何在我的显示功能中调用它
<!-- ALL MEMBERS QUERY -->
<div id="allmembers" class="content">
<?php
include("connection.php"); #DATABASE CONNECTION DO NOT EDIT
#Moderators
$sql="SELECT user_id, special_id, login, user_type, company FROM $tbl_name";
$result=mysql_query($sql);
#count all mods
$count=mysql_num_rows($result);
?>
<br style="clear:both;">
<div style="float:left;margin-left:1%;">
<?php echo "<font size='3px'>There are $count users:</font>"; #OUTPUT COUNT MODS ?>
</div>
<br/><br/>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td>
<form name="form1" method="post" action="" onsubmit="return confirm('Click OK or Cancel to Continue');">
<table width="100%" border="1%" cellpadding="3" cellspacing="1">
<tr>
<td align="center">#</td>
<td align="center"><strong>Id</strong></td>
<td align="center"><strong>Name</strong></td>
<td align="center"><strong>User Type</strong></td>
<td align="center"><strong>Company</strong></td>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td align="center"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<? echo $rows['special_id']; ?>"></td>
<td width="10%"><? echo $rows['special_id']; ?></td>
<td width="25%"><? echo $rows['login']; ?></td>
<td width="20%"><? echo $rows['user_type']; ?></td>
<td><? echo $rows['company']; ?></td>
<td><a href="<?echo $rows['user_id']; ?>">View</a></td>
</tr>
<?php
}
?>
<tr>
<td width="10%" border="0"><input name="delete" type="submit" id="delete" value="Delete Selected User(s)"></td>
</tr>
</table>
</form>
</td>
</tr>
<?php
// Check if delete button active, start this
if($_POST['delete']){
$checkbox=$_POST['checkbox'];
for($i=0;$i<count($checkbox);$i++){
$del_id = $checkbox[$i];
$sql = "DELETE FROM $tbl_name WHERE special_id='$del_id'";
$result = mysql_query($sql);}
// if successful redirect back to manage_users.php
if($result){
echo "<meta http-equiv=\"refresh\" content=\"0;URL=manage_users.php\">"; #REDIRECTION ITSELF
}
}
?>
</table>