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 2045
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
Markus 6,050
Recognized Expert Expert
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_de lete.php?Member _No=<?php echo $rows['Member_No'];?>&something=e lse">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.
Markus 6,050
Recognized Expert Expert
I tried this
<a href="member_de lete.php?Member _No=<?php echo $rows['Member_No'];?>&something=e lse">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 in el:
|
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 I am
trying to access freed.
memory.
Is my assumption correct?
I tried following code
---------------------------------------------------
#include <iostream.h>
|
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 http://groups.google.ca/groups?hl=en&lr=&ie=UTF-8&threadm=AXqqc.89218%24PJ1.865449%40wagner.videotron.net&rnum=1&prev=/groups%3Fq%3Dmatan%2Bnassau%26hl%3Den%26lr%3D%26ie%3DUTF-8%26sa%3DG%26scoring%3Dd
)
VariableExp *x = new VariableExp("X");
VariableExp *y = new VariableExp("Y");...
|
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 following code:
Private Sub Command28_Click()
On Error GoTo Err_Command28_Click
| |
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 trying to delete these lines from the
dataview like this:
for (int i=0; i < dataView.Count; i++)
if (dataGrid.IsSelected(i))
dataView.Delete(i);
|
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 restarts and all active sessions are
terminated.
This error is also described in detail here:...
|
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,
removing all the files/folders inside it.
The problem i am having is that i can only delete files in the
Windows/Temp folder, and i can't delete folders if they contain files,
i know that you can't do this.
|
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;
down here am posting my code; please somebody who can point it out; let me know fast; whats wrong in it...
//Delete a number next to the given number
void afterdelete()
{
struct linklist*temp=NULL;
int no=0;
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |