Hello there,
I have been trying to delete a row in php for a long time now and its getting frustrating, can any see if they could possible help me please.
My first page is - <?php
-
// this starts the session
-
session_start();
-
?>
-
<html>
-
-
<head>
-
<h1><font face="sans-serif, Arial" font color="white">Members Page!</h1>
-
</head>
-
-
<body background="main background1.jpg" link="yellow" vlink="yellow" hover="green" >
-
<a href="blank.php">Back To Main page</a>
-
-
<table align="center" width="600" border="0" cellspacing="0" cellpadding="1" >
-
<tr>
-
<td><font face="sans-serif, Arial" color="white" size= "-1">DESC Order</td>
-
<td><a href="member_select_md.php"><font face="sans-serif, Arial" font font size= "-1">Member DESC</a></td>
-
<td><a href="member_select_sd.php"><font face="sans-serif, Arial" font font size= "-1">Surname DESC</a></td>
-
<td><a href="member_select_fd.php"><font face="sans-serif, Arial" font font size= "-1">Forename DESC</a></td>
-
<td><a href="member_select_ad.php"><font face="sans-serif, Arial" font font size= "-1">Address DESC</a></td>
-
<td><a href="member_select_dd.php"><font face="sans-serif, Arial" font font size= "-1">DOB DESC</a></td>
-
</tr>
-
<tr>
-
<td><font face="sans-serif, Arial" color="white" font font size= "-1">ASC Order</td>
-
<td><a href="member_select.php"><font face="sans-serif, Arial" font size= "-1">Member ASC</a></td>
-
<td><a href="member_select_sa.php"><font face="sans-serif, Arial" font size= "-1">Surname ASC</a></td>
-
<td><a href="member_select_fa.php"><font face="sans-serif, Arial" font size= "-1">Forename ASC</a></td>
-
<td><a href="member_select_aa.php"><font face="sans-serif, Arial" font size= "-1">Address ASC</a></td>
-
<td><a href="member_select_da.php"><font face="sans-serif, Arial" font size= "-1">DOB ASC</a></td>
-
</tr>
-
</table>
-
<br><br><br>
-
<table align="right" width="700" border="1" cellspacing="0" cellpadding="3" >
-
<tr>
-
-
<td align="center" width="12%"><b><u><font face="sans-serif, Arial" font color="white">Member No</b></u></td>
-
<td align="center" width="13%"><b><u><font face="sans-serif, Arial" font color="white">Surname</b></u></td>
-
<td align="center" width="13%"><b><u><font face="sans-serif, Arial" font color="white">Forename</b></u></td>
-
<td align="center" width="40%"><b><u><font face="sans-serif, Arial" font color="white">Address</b></u></td>
-
<td align="center" width="25%"><b><u><font face="sans-serif, Arial" font color="white">DOB</b></u></td>
-
<td align="center" width="5%"></td>
-
</tr>
-
</table>
-
<br><br><br><br>
-
<?php
-
$db_name="project"; // Database name
-
$tbl_name="member"; // Table name
-
-
// Connect to server and select database.
-
mysql_connect($_SESSION['host'], $_SESSION['username'], $_SESSION['password'])or die("cannot connect");
-
mysql_select_db("$db_name")or die("cannot select DB");
-
-
$memberno=urlencode($_GET['Member_No']);
-
-
// Retrieve data from database
-
$sql="SELECT * FROM $tbl_name ORDER BY `Member_No` ASC";
-
$result=mysql_query($sql);
-
-
// Start looping rows in mysql database.
-
while($rows=mysql_fetch_array($result)){
-
?>
-
-
<table width="700" border="1" cellspacing="0" cellpadding="3" align="right">
-
<tr>
-
-
<td width="12%" align="center"><font face="sans-serif, Arial" font color="white"><? echo $rows['Member_No']; ?></td>
-
<td width="13%" align="center"><font face="sans-serif, Arial" font color="white"><? echo $rows['Surname']; ?></td>
-
<td width="13%" align="center"><font face="sans-serif, Arial" font color="white"><? echo $rows['Forename']; ?></td>
-
<td width="40%" align="center"><font face="sans-serif, Arial" font color="white"><? echo $rows['Address']; ?></td>
-
<td width="25%" align="center"><font face="sans-serif, Arial" font color="white"><? echo $rows['DOB']; ?></td>
-
<td width="5%" align="center" ><a href="member_delete.php">delete</a>
-
</tr>
-
</table>
-
<br><br><br>
-
<?
-
// close while loop
-
}
-
-
// close connection
-
mysql_close();
-
?>
-
-
</body>
-
</html>
------------------------------------------------------------------------------------------------------------------
I get a delete button next to all the rows but when I click on the delete button I get a blank screen, the coding for the delete button is: -
------------------------------------------------------------------------------------------------------------------- - <?php
-
// this starts the session
-
session_start();
-
?>
-
-
<?php
-
-
$db_name="project"; // Database name
-
$tbl_name="member"; // Table name
-
-
// Connect to server and select database.
-
mysql_connect($_SESSION['host'], $_SESSION['username'], $_SESSION['password'])or die("cannot connect");
-
mysql_select_db("$db_name")or die("cannot select DB");
-
-
$memberno=urldecode($_GET['Member_No']);
-
-
-
//$db->query("DELETE FROM $tbl_name WHERE Member_No = '$Member_No'";
-
-
$query = ("DELETE FROM $tbl_name WHERE Member_No = '".$_GET["Member_No"]."' LIMIT 1");
-
-
$result = mysql_query($query);
-
-
//header("location: member_select.php");
-
-
//$sql= "DELETE FROM $tbl_name WHERE Member_No = $memberno";
-
-
//$result=mysql_query($sql);
-
//echo "row deleted";
-
-
// close connection
-
mysql_close();
-
?>
---------------------------------------------------------------------------------------------------------------
As you can see I have tried alot, could any one please help.
Thank you in advanced
5 2028
In the first form I see no delete button, no form and no form submission. So how do you pass the clicked record to be deleted to the delete script?
Ronald
on line 71 where you have the delete button, shouldnt you be passing the $memberno through the url?
on line 71 where you have the delete button, shouldnt you be passing the $memberno through the url?
I tried this
[php]<a href="member_delete.php?Member_No=<?php echo $rows['Member_No'];?>&something=else">delete</a>[/php]
It works! ok it wasnt working before, thank you for your help sorry to have wasted your time, you must have good luck thank you again much appriciated.
I tried this
<a href="member_delete.php?Member_No=<?php echo $rows['Member_No'];?>&something=else">delete</a>
It works! ok it wasnt working before, thank you for your help sorry to have wasted your time, you must have good luck thank you again much appriciated.
Not goodluck - just did the usual debugging :)
See you around again!
Not goodluck - just did the usual debugging :)
See you around again!
:) will do thanks again
Sign in to post your reply or Sign up for a free account.
Similar topics
by: flupke |
last post by:
Hi,
i'm having trouble with deleting elements from a list in a for loop
============== test program ==============
el =
print "**** Start ****"
print "List = %s " % el
index = 0
for line...
|
by: Rick |
last post by:
Hi,
Does deleting an object more than one times incur undefined behavior? I
think it doesn't but just making sure... thanks
Rick
|
by: Abhijeet |
last post by:
I was just toying around idea of deleting this from a member function.
Was expecting that any acess to member variable or function after
deleting sould give me dump(segmetation violation).Cause now...
|
by: Matan Nassau |
last post by:
Hello.
i have a composite which i want to delete. this is a composite which
represents a boolean expression (see a previous post of mine with more
details at...
|
by: Nathan Bloom |
last post by:
Hi,
I have a data entry form (access 2000) that also allows the user to add,
update, and delete records from the form. The Delete action is carried out
in an event procedure and has the...
|
by: Mojtaba Faridzad |
last post by:
Hi,
with SetDataBinding( ) a DataGrid shows a DataView. user can select some
rows in the grid by holding cotrol key. when user clicks on Delete button, I
should delete all selected rows. I am...
|
by: al havrilla |
last post by:
hi all
what does the phrase: "scalar deleting destructor" mean?
i'm getting this in a debug error message using c++ 7.1
thanks
Al
|
by: Martin Bischoff |
last post by:
Hi,
I'm creating temporary directories in my web app (e.g. ~/data/temp/temp123)
to allow users to upload files. When I later delete these directories (from
the code behind), the application...
|
by: Kimera.Kimera |
last post by:
I'm trying to write a program in VB.net 2003 that basically deletes all
files, folders, sub-folders and sub-sub folders (etc).
The program is simply for deleting the Windows/Temp folder contents,...
|
by: Parul Bagadia |
last post by:
I have written a code for deleting certain value from linklist;
it's not working; where as i have written one for deleting a no., after given no. which works fine! I even debugged it; but invain;...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |