gpt4 book ai didi

按钮的 PHP 条件设置

转载 作者:搜寻专家 更新时间:2023-10-31 21:27:17 25 4
gpt4 key购买 nike

<分区>

enter image description here enter image description here

对于第一页,我想将“内容控制”列设置为“更新或删除”按钮,因为它已经获得了特定行的数据。对于第二页,我想将“内容控件”列设置为“添加或更新或删除”按钮,因为它还没有数据和行。我面临的问题是如何将第一页设置为包含按钮“更新或删除”,而第二页设置为包含按钮“添加或更新或删除”。

<?php
$conn = mysql_connect("localhost","root","");
mysql_select_db("smart_train",$conn);
$result = mysql_query("SELECT * FROM station");
?>
<?php
$i=0;
while($row = mysql_fetch_array($result)) {
$i%2==0;
switch ($i) {
case "0":
$classname="1Row";
$goesToPage='add_station_update1.php';
break;
case "1":
$classname="2Row";
$goesToPage='add_station_update2.php';
break;
case "2":
$classname="3Row";
$goesToPage='add_station_update3.php';
break;
case "3":
$classname="4Row";
$goesToPage='add_station_update4.php';
break;
case "4":
$classname="5Row";
$goesToPage='add_station_update5.php';
break;
case "6":
$classname="6Row";
$goesToPage='add_station_update6.php';
break;
case "6":
$classname="7Row";
$goesToPage='add_station_update7.php';
break;
case "7":
$classname="8Row";
$goesToPage='add_station_update8.php';
break;
case "8":
$classname="9Row";
$goesToPage='add_station_update9.php';
break;
case "9":
$classname="10Row";
$goesToPage='add_station_update10.php';
break;
}
?>
<tr>
<td> <?php echo $row["id"];?> </td>
<td> <?php echo $row["thailand"];?> </td>
<td> <?php echo $row["malaysia"];?> </td>
<td>
<div class="btn-group" class="<?php if(isset($classname)) echo $classname;?>">
<a href="<?php echo $goesToPage; ?>">
<button onclick="myFunction()" type="button" class="btn btn-warning">Update</button>
</a>
<a><button type="button" class="btn btn-default" id="content_control_or">or</button></a>
<a><button type="button" class="btn btn-warning">Delete</button></a>
<?php if(isset($message)) { echo $message; } ?>
</div>
<div class="btn-group" class="<?php if(isset($addclass)) echo $addclass;?>">
<a href="<?php echo $goesToPage; ?>">
<button onclick="myFunction()" type="button" class="btn btn-warning">Add</button>
</a>
<a><button type="button" class="btn btn-default" id="content_control_or">or</button></a>
<a href="<?php echo $goesToPage; ?>">
<button onclick="myFunction()" type="button" class="btn btn-warning">Update</button>
</a>
<a><button type="button" class="btn btn-default" id="content_control_or">or</button></a>
<a><button type="button" class="btn btn-warning">Delete</button></a>
<?php if(isset($message)) { echo $message; } ?>
</div>
<?php
$i++;
}
?>
</td>
</tr>

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com