使用php中的编辑和删除图像删除和更新行(Delete and update row using edit and delete image in php)
这是我的branch.php页面,我想在用户点击php中的编辑和删除图像时删除和更新行,直接在表中删除或更新该行。但是这两行都没有更新或删除。
<?php $a1=mysql_connect('localhost','root1','oec@123'); $b1=mysql_select_db('rms',$a1); ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>branch</title> <link href="styles/branch.css" rel="stylesheet" type="text/css"> </head> <body> <div id="wrapper"> <header id="top"> <h1>Reporter Management System</h1> <nav id="mainnav"> <ul> <li><a href="admin.php">Home</a></li> <li><a href="branch.php">Branch</a></li> <li><a href="branchadmin.php">Branch Admin</a></li> <li><a href="reporter.php">Reporters</a></li> <li><a href="accountant.php">Accountant</a></li> <li><a href="setting.php">Settings</a></li> <li><a href="">Log out</a></li> </ul> </nav> </header> <div id="hero"> <img src="News2.jpg" width="1000" height="320" alt=""/> </div> <form role="form" action ="searchbranch.php" method="post"> <p><label for="Search">Search Branch :</label> <input class="textbox" type="Search" placeholder="Name" name="Search"> <input type="submit" class="classname" value="Search" > </form> <form role= "form" action="createbranch.php" method="post"> <input type="submit" class="classname" value="Add Branch" onClick="href 'createbranch.php' " ></p> </form> <section class="page container"> <div> <div class="span12"> <div class="box pattern "> <div class="box-header"> <i class="icon-list"></i> </div> <table id="sample-table" class="table table-hover table-bordered tablesorter"> <thead> <tr> <th>Sl no</th> <th>Branch</th> <th>Description</th> <th>Action</th> </tr> <?php $w='SELECT Sl_no, branch, description from create_branch;'; $recordset=mysql_query($w,$a1) or die(mysql_error()); $totalrows=mysql_num_rows($recordset); $row_recordset=mysql_fetch_assoc($recordset); if($totalrows>0) { do { $r=$row_recordset['Sl_no']; $d=$row_recordset['branch']; $d1=$row_recordset['description']; ?> </thead> <tbody id='tb-content'> <tr> <td><?php echo $r ;?></td> <td><?php echo $d ;?></td> <td><?php echo $d1 ;?></td> <td> <?php echo ' <a href="edit_branch.php?no='.$row_recordset['Sl_no'].'">'?> <img src="pencil.png" /> <?php '</a>';? > | <?php echo' <a href="branch_delete.php?no1='.$row_recordset['branch'].'">'?> <img src="cross.png" /> <?php '</a>';?> </td> </tr> <?php }while($row_recordset=mysql_fetch_assoc($recordset)); } mysql_free_result($recordset); mysql_close($a1); ?> </tbody> </table> </div> </div> </div> </section> </body> <footer> <p> </p><hr> <center>©Copyright 2015 RepoterManagnmentSystem </center> </footer> </div> </body> </html>
这是branch_delete.php
<?php $cn=mysql_connect('localhost','root1',"oec@123"); $db_selected=mysql_select_db('rms',$cn); $bn=$_REQUEST['no1']; $sql='DELETE au.Sl_no,au.name,au.company_name,au.email_id,au.password,au.confirm_password,au.group,au.branch,au.phone,au.wordcount,au.rating,cb.Sl_no,cb.branch,cb.description from admin_user au,create_branch cb where cb.branch="'.$bn.'" AND au.branch=cb.branch ;'; $s1=mysql_query($sql,$cn); mysql_close($cn); header('Location: branch.php'); ?>
这是update_branch.php
<?php $a1=mysql_connect('localhost','root1','oec@123'); $b1=mysql_select_db('rms',$a1); $bn=$_REQUEST['bname']; $sn=$_REQUEST['Sl_no']; $d=$_REQUEST['descp']; $w= 'SELECT branch,description FROM create_branch;'; $recordset=mysql_query($w,$a1) or die(mysql_error()); $totalrows=mysql_num_rows($recordset); $row_recordset=mysql_fetch_assoc($recordset); if($totalrows>0) { do { $r=$row_recordset['branch']; $s=$row_recordset['description']; if($bn==$r and $d==$s) { ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> <link href="styles/createbranch.css" rel="stylesheet" type="text/css"> </head> <body> <div id="wrapper"> <header id="top"> <h1>Reporter Management System</h1> <nav id="mainnav"> <ul> <li><a href="index.html">Home</a></li> <li><a href="">Branch</a></li> <li><a href="">Branch Admin</a></li> <li><a href="">Reporters</a></li> <li><a href="">Accountant</a></li> <li><a href="">Settings</a></li> <li><a href="">Log out</a></li> </ul> </nav> </header> <div id="hero"> <img src="News2.jpg" width="1000" height="320" alt=""/> </div> <form method="post" action="edit_branch.php"> <article id="main"> <?php echo '<h2>branch already exists</h2>' ; ?> <h2>Create Branch</h2><hr> <p><label for="branch name">Branch Name:</label><br><br> <input class="textbox" type="text" placeholder=" <?php echo $bn ;?>" name="bname"></p><br> <p><label for="Description">Description:</label><br><br> <input class="textbox" type="text" placeholder="<?php echo $d ;?>" name="descp"></p><br> <input type="submit" class="classname" value="Update Branch" ></p> <br> </article> </form> <footer> <p> </p><hr> <center> © Copyright 2015 ReporterManagementSystem</center> </footer> </div> </body> </html> <?php exit(0); } } while($row_recordset=mysql_fetch_assoc($recordset)); $w1='UPDATE create_branch set branch="'.$bn.'" and description="'.$d.'" where Sl_no="'.$sn.'";'; $x=mysql_query($w1,$a1) or die(mysql_error()); ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <div id="wrapper"> <header id="top"> <h1>Reporter Management System</h1> <nav id="mainnav"> <ul> <li><a href="branchadmin.php">Home</a></li> <li><a href="reporters.php">Reporters</a></li> <li><a href="content1.php">News Content</a></li> <li><a href="CreateUser.php">Add user</a></li> <li><a href="">Log Out</a></li> </ul> </nav> </header> <img src="News2.jpg" width="1000" height="320" alt=""/> <?php echo "<br>"; if($x=="true") { header('Location: branch.php'); } else { echo "fail to update branch"; } echo"<br>"; } mysql_free_result($recordset); mysql_close($a1); ?>
This is my branch.php page and I want to delete and update row when the user click on the edit and delete image in php and directly the row should be deleted or updated in the table.But It is not working neither row is getting updated or deleted.
<?php $a1=mysql_connect('localhost','root1','oec@123'); $b1=mysql_select_db('rms',$a1); ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>branch</title> <link href="styles/branch.css" rel="stylesheet" type="text/css"> </head> <body> <div id="wrapper"> <header id="top"> <h1>Reporter Management System</h1> <nav id="mainnav"> <ul> <li><a href="admin.php">Home</a></li> <li><a href="branch.php">Branch</a></li> <li><a href="branchadmin.php">Branch Admin</a></li> <li><a href="reporter.php">Reporters</a></li> <li><a href="accountant.php">Accountant</a></li> <li><a href="setting.php">Settings</a></li> <li><a href="">Log out</a></li> </ul> </nav> </header> <div id="hero"> <img src="News2.jpg" width="1000" height="320" alt=""/> </div> <form role="form" action ="searchbranch.php" method="post"> <p><label for="Search">Search Branch :</label> <input class="textbox" type="Search" placeholder="Name" name="Search"> <input type="submit" class="classname" value="Search" > </form> <form role= "form" action="createbranch.php" method="post"> <input type="submit" class="classname" value="Add Branch" onClick="href 'createbranch.php' " ></p> </form> <section class="page container"> <div> <div class="span12"> <div class="box pattern "> <div class="box-header"> <i class="icon-list"></i> </div> <table id="sample-table" class="table table-hover table-bordered tablesorter"> <thead> <tr> <th>Sl no</th> <th>Branch</th> <th>Description</th> <th>Action</th> </tr> <?php $w='SELECT Sl_no, branch, description from create_branch;'; $recordset=mysql_query($w,$a1) or die(mysql_error()); $totalrows=mysql_num_rows($recordset); $row_recordset=mysql_fetch_assoc($recordset); if($totalrows>0) { do { $r=$row_recordset['Sl_no']; $d=$row_recordset['branch']; $d1=$row_recordset['description']; ?> </thead> <tbody id='tb-content'> <tr> <td><?php echo $r ;?></td> <td><?php echo $d ;?></td> <td><?php echo $d1 ;?></td> <td> <?php echo ' <a href="edit_branch.php?no='.$row_recordset['Sl_no'].'">'?> <img src="pencil.png" /> <?php '</a>';? > | <?php echo' <a href="branch_delete.php?no1='.$row_recordset['branch'].'">'?> <img src="cross.png" /> <?php '</a>';?> </td> </tr> <?php }while($row_recordset=mysql_fetch_assoc($recordset)); } mysql_free_result($recordset); mysql_close($a1); ?> </tbody> </table> </div> </div> </div> </section> </body> <footer> <p> </p><hr> <center>©Copyright 2015 RepoterManagnmentSystem </center> </footer> </div> </body> </html>
This is branch_delete.php
<?php $cn=mysql_connect('localhost','root1',"oec@123"); $db_selected=mysql_select_db('rms',$cn); $bn=$_REQUEST['no1']; $sql='DELETE au.Sl_no,au.name,au.company_name,au.email_id,au.password,au.confirm_password,au.group,au.branch,au.phone,au.wordcount,au.rating,cb.Sl_no,cb.branch,cb.description from admin_user au,create_branch cb where cb.branch="'.$bn.'" AND au.branch=cb.branch ;'; $s1=mysql_query($sql,$cn); mysql_close($cn); header('Location: branch.php'); ?>
This is update_branch.php
<?php $a1=mysql_connect('localhost','root1','oec@123'); $b1=mysql_select_db('rms',$a1); $bn=$_REQUEST['bname']; $sn=$_REQUEST['Sl_no']; $d=$_REQUEST['descp']; $w= 'SELECT branch,description FROM create_branch;'; $recordset=mysql_query($w,$a1) or die(mysql_error()); $totalrows=mysql_num_rows($recordset); $row_recordset=mysql_fetch_assoc($recordset); if($totalrows>0) { do { $r=$row_recordset['branch']; $s=$row_recordset['description']; if($bn==$r and $d==$s) { ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> <link href="styles/createbranch.css" rel="stylesheet" type="text/css"> </head> <body> <div id="wrapper"> <header id="top"> <h1>Reporter Management System</h1> <nav id="mainnav"> <ul> <li><a href="index.html">Home</a></li> <li><a href="">Branch</a></li> <li><a href="">Branch Admin</a></li> <li><a href="">Reporters</a></li> <li><a href="">Accountant</a></li> <li><a href="">Settings</a></li> <li><a href="">Log out</a></li> </ul> </nav> </header> <div id="hero"> <img src="News2.jpg" width="1000" height="320" alt=""/> </div> <form method="post" action="edit_branch.php"> <article id="main"> <?php echo '<h2>branch already exists</h2>' ; ?> <h2>Create Branch</h2><hr> <p><label for="branch name">Branch Name:</label><br><br> <input class="textbox" type="text" placeholder=" <?php echo $bn ;?>" name="bname"></p><br> <p><label for="Description">Description:</label><br><br> <input class="textbox" type="text" placeholder="<?php echo $d ;?>" name="descp"></p><br> <input type="submit" class="classname" value="Update Branch" ></p> <br> </article> </form> <footer> <p> </p><hr> <center> © Copyright 2015 ReporterManagementSystem</center> </footer> </div> </body> </html> <?php exit(0); } } while($row_recordset=mysql_fetch_assoc($recordset)); $w1='UPDATE create_branch set branch="'.$bn.'" and description="'.$d.'" where Sl_no="'.$sn.'";'; $x=mysql_query($w1,$a1) or die(mysql_error()); ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <div id="wrapper"> <header id="top"> <h1>Reporter Management System</h1> <nav id="mainnav"> <ul> <li><a href="branchadmin.php">Home</a></li> <li><a href="reporters.php">Reporters</a></li> <li><a href="content1.php">News Content</a></li> <li><a href="CreateUser.php">Add user</a></li> <li><a href="">Log Out</a></li> </ul> </nav> </header> <img src="News2.jpg" width="1000" height="320" alt=""/> <?php echo "<br>"; if($x=="true") { header('Location: branch.php'); } else { echo "fail to update branch"; } echo"<br>"; } mysql_free_result($recordset); mysql_close($a1); ?>
原文:https://stackoverflow.com/questions/29192547
最满意答案
Twitter上的用户向我指出了一个PDF,我无法相信我以前没有找到过
http://www.semanticmerge.com/documents/SemanticMerge-Perforce.pdf
简而言之,有必要创建一个批处理文件来在Perforce中启动外部差异和合并工具。
A user on twitter pointed me at a PDF which I can't believe I hadn't previously managed to find
http://www.semanticmerge.com/documents/SemanticMerge-Perforce.pdf
In short it's necessary to create a batch file to launch external diff and merge tools in Perforce.
相关问答
更多-
我们所犯的一个错误是(a)将文件从一个分支集成到另一个分支,(b)将其解析为“接受合并”,(c)在(d)提交之前对文件进行本地更改。 如果在步骤(b)之后和步骤(c)之前未明确打开要编辑的文件,则服务器不知道您的本地更改。 One mistake we've all made is to (a) integrate a file from one branch to another, (b) resolve it as "accept merged", (c) make local changes to t ...
-
语义差异(Semantic Diff Utilities [closed])[2022-03-20]
我们开发了一个能够精确处理这种情况的工具。 检查http://www.semanticmerge.com 它基于代码结构合并(和diffs),而不是使用基于文本的算法,这基本上允许您处理如下的案例,涉及强重构。 它也可以呈现出差异和合并冲突,如下所示: 而不是被移动的文本块变得困惑,因为它首先解析,它能够以每个方法为基础显示冲突(实际上是每个元素)。 像以前一样的案例甚至不会有手动的冲突来解决。 这是一个语言感知的合并工具,一直很好,终于能够回答这个SO问题:-) We've developed a too ... -
如何在perforce中的两个挂起的更改列表之间进行区分?(How does one diff between two pending changelists in perforce?)[2022-10-06]
服务器的最新版本支持对打开的文件取消对工作区的更改,并解决合并问题。 所以,假设你的服务器已经够用了,你只需要: 搁置变化 从干净的工作空间开始 取消对该工作空间中的一项更改 取消对同一工作区的其他更改 解决导致的任何合并更改。 在提交之前仔细检查你的差异,以确保你有你想要的改变。 Recent versions of the server support unshelving a change into a workspace with opened files, and resolving the me ... -
您可以通过创建bat文件来完成此操作。 在bat文件中,您可以使用正确的参数调用合并程序。 这是我的bat文件的内容: TortoiseMerge.exe /base:%1 /theirs:%2 /mine:%3 /merged:%4 p4 %b %1 %2 %r : 如你所见,我调用了我的bat文件“p4Helper.bat” Sadly P4V's argument replacement is broken. You can use TortoiseMerge for diffing, but no ...
-
Twitter上的用户向我指出了一个PDF,我无法相信我以前没有找到过 http://www.semanticmerge.com/documents/SemanticMerge-Perforce.pdf 简而言之,有必要创建一个批处理文件来在Perforce中启动外部差异和合并工具。 A user on twitter pointed me at a PDF which I can't believe I hadn't previously managed to find http://www.semant ...
-
GitExtensions可以做类似的事情 GitExtensions can do something similar to this
-
diff.guitool仅在使用--gui标志时适用 。 设置diff.tool和diff.tool应该使git difftool和git mergetool使用不同的工具: [merge] tool = kdiff3 [diff] tool = meld diff.guitool only applies if you use the --gui flag. Setting diff.tool and merge.tool should make git difftoo ...
-
如果您使用的是P4V,请转到编辑 - >首选项,然后转到差异选项卡。 选择“其他应用程序”单选按钮,然后选择要使用的程序。 If you're using P4V, go to Edit -> Preferences, and then to go the Diff tab. Pick the "Other application" radio button and then pick the program you want to use.
-
在从另一个答案调查meta-diff时,我发现了一个内置于P4V本身的解决方案。 事实证明,P4V中用于指定diff工具的对话框有一组额外的选项,可以为不同的文件扩展名指定不同的工具。 因此,我似乎根本不需要编写插件或扩展p4v,我只需要正确设置这些属性。 While investigating meta-diff from another answer I found a solution built into P4V itself. It turns out that the dialog in P4V ...
-
如何将p4merge设置为Visual Studio 2015的差异工具|(How to set up p4merge as diff tool for Visual Studio 2015 | git)[2022-08-03]
我假设您在默认安装目录中安装了P4Merge,如果没有在下面列出的命令中相应地编辑目录。 在命令行中执行这些命令,将Git的默认mergetool和difftool设置为P4Merge。 git config --global merge.tool p4merge git config --global mergetool.p4merge.path "C:/Program Files/Perforce/p4merge.exe" git config --global diff.tool p4merge gi ...