使用PHP在SQL中检索检索数据中添加更新和删除按钮

时间:2016-05-07 16:17:09

标签: php mysql sql sql-update sql-delete

我正在使用PHP在页面上从SQL检索数据,并使用下面的代码一次显示多条记录。

removeRear

现在的问题是我想为从数据库中检索到的每一行添加<?php //Database Connection File require_once("config.php"); //Everything Is Okay So Let's Garb This User Contacts Data $garb = mysqli_query($connection, "SELECT * FROM contacts WHERE A_Id = '$A_Id'"); if(!$garb){ $error = "<div class='error'>There's Little Problem: ".mysql_error()."</div>"; } else { //Data Is Collected //Showing The User Data $idNo = 0; while($row = mysqli_fetch_array($garb)) { $C_FullName = $row['C_FullName']; $C_Gender = $row['C_Gender']; $C_ContactPhone = $row['C_ContactPhone']; $C_ContactCell = $row['C_ContactCell']; $C_Email = $row['C_Email']; $C_Address = $row['C_Address']; $C_Group = $row['C_Group']; $C_Notes = $row['C_Notes']; echo ' <div class="accordionItem close"> <h3 class="accordionItemHeading">'.$C_FullName.'</h3> <div class="accordionItemContent"> <div id="contactDetailes"> <form id="updateAllContact'.$idNo.'" method="post" action=""> <p><label>Full Name:* </label><input type="text" name="C_FullName" value="'.$C_FullName.'"></input></p> <p><label>Gender:* </label><input type="text" name="C_Gender" value="'.$C_Gender.'"></input></p> <p><label>Contact No(Phone): </label><input type="text" name="C_ContactPhone" value="'.$C_ContactPhone.'"></input></p> <p><label>Contact No(Cell): </label><input type="text" name="C_ContactCell" value="'.$C_ContactCell.'"></input></p> <p><label>Email Address:* </label><input type="text" name="C_Email" value="'.$C_Email.'"></input></p> <p><label>Address: </label><input type="text" name="C_Address" value="'.$C_Address.'"></input></p> <p><label>Group: </label><input type="text" name="C_Group" value="'.$C_Group.'"></input></p> <p><label>Notes: </label><textarea type="text" name="C_Notes">'.$C_Notes.'</textarea></p> <span> <a class="updateButton">Update</a> <a class="deleteButton">Delete</a> </span> </form> </div> </div> </div> '; $idNo++; } } ?> Update函数。我想要的是类似HTML5 Web SQL Databases And Usage或类似HTML5 Address Book的使用PHP和SQL的东西。那么如何在我的每一行数据中添加DeleteUpdate的函数...... ???

0 个答案:

没有答案