IT Community - Software Programming, Web Development and Technical Support

deleting specific rows in a table using php

This is a discussion on deleting specific rows in a table using php within the PHP Programming forums, part of the Web Development category; how do I make the trashcan link for deleting rows in a table work using php??? I want my trashcans ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > PHP Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 09-06-2007, 03:04 AM
Archimedees Archimedees is offline
D-Web Trainee
 
Join Date: Aug 2007
Posts: 15
Archimedees is on a distinguished road
Default deleting specific rows in a table using php

how do I make the trashcan link for deleting rows in a table work using php???
I want my trashcans on each row of $arLines to be able to delete the row when clicked. Following is script but I'm not sure unset() is useful here. Could somebody please assist with idea? Thanks in advance.

Quote:
<form name="urllist" action="display.php" method="get">
<table border=1>
<tr>
<th></th>
<th></th>
<th>URL</th>
<th>Notify-Email</th>
<th>Size</th>
<th>Command</th>
<th>Delete</th>
</tr>

<?php

$i=0;
$nMaxarLine = Count($arLine);
for($i=0;$i<$nMaxarLine;$i++)
{
$arTrashCans = unset($arLine[$i]);
}

foreach($arParsedLines as $key => $arLine)
{
echo "<tr>\n";
echo " <td></td>\n";
echo " <td><input type=\"checkbox\" name=\"active_".$key."\" value=\"active\"";
if ($arLine["active"]==true)
{
echo "checked";
}
echo "></td>\n";
echo " <td>".$arLine["url"]."</td>\n";
echo " <td>".$arLine["email"]."</td>\n";
echo " <td>".$arLine["size"]."</td>\n";
echo " <td>".$arLine["command"]."</td>\n";
echo " <td><a href="$arTrashCans/">Delete</a>;
echo "</tr>\n";

}//end foreach($arParsedLines as $arLine)
?>
</table>
<input type="submit" name="uebernehmen" value="uebernehmen">
</form>
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-06-2007, 07:13 AM
vijayanand vijayanand is offline
D-Web Analyst
 
Join Date: Feb 2007
Posts: 293
vijayanand is on a distinguished road
Default Re: deleting specific rows in a table using php

Hi Archimedees,
whether the displaying details in the table is ordinary array variable or a MySql returned array variable. If i know the details regarding this, It is possible for me to clear ur doubt.
__________________

J.Vijayanand
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-06-2007, 07:50 AM
Archimedees Archimedees is offline
D-Web Trainee
 
Join Date: Aug 2007
Posts: 15
Archimedees is on a distinguished road
Default Re: deleting specific rows in a table using php

The displaying stuff is just ordinary array variables. No mysql.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-10-2007, 08:51 AM
Sabari Sabari is offline
D-Web Genius
 
Join Date: Jul 2007
Posts: 1,008
Sabari is on a distinguished road
Default Re: deleting specific rows in a table using php

Hi Archimedees,

I've little bit confusion on your table row deletion, can you please give some example array($arLines)? i'll workout and then give some other synchronized code?
__________________
Thanks & Regards
Sabari...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 09-11-2007, 12:54 AM
vijayanand vijayanand is offline
D-Web Analyst
 
Join Date: Feb 2007
Posts: 293
vijayanand is on a distinguished road
Default Re: deleting specific rows in a table using php

Quote:
Originally Posted by Archimedees View Post
how do I make the trashcan link for deleting rows in a table work using php???
I want my trashcans on each row of $arLines to be able to delete the row when clicked. Following is script but I'm not sure unset() is useful here. Could somebody please assist with idea? Thanks in advance.
Hi Archimedees,
Ok fine if u using the only the array variables, what u said is correct u can delete the array by using the unset() function.
__________________

J.Vijayanand
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 09-14-2007, 02:08 AM
Archimedees Archimedees is offline
D-Web Trainee
 
Join Date: Aug 2007
Posts: 15
Archimedees is on a distinguished road
Default Re: deleting specific rows in a table using php

Thanks for response,

Maybe I should frame my question differently.
I have a link that is in my table rows meant to delete the lines in the rows when clicked. Each row contains $arParsedLines[]

Quote:
echo " <td>a href=\"deleterow.php?line_".$key."\">delete</a></td>\n";
I'm in the process ot writing deleterow.php and I'm kinda lost how to connect my delete link to what should be deleted. I am supposed to delete the array with unset ($arParsedLines[i]). How do I use the line_".$key." from the link to do this. This is a mind twister
Grateful for any direction.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 09-14-2007, 02:51 AM
ragavraj ragavraj is offline
D-Web Programmer
 
Join Date: Feb 2007
Posts: 92
ragavraj is on a distinguished road
Default Re: deleting specific rows in a table using php

Hi Archimedees
why you use file concept for this process (any specific reason ) we can easily handle this process using database (Mysql or Oracle )

Thanks
R.Rajan
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to give confirmation for deleting in datagrid? krishnakumar ASP and ASP.NET Programming 3 04-03-2008 06:12 AM
What is the difference between DELETE TABLE and TRUNCATE TABLE commands in SQL Server oxygen Database Support 6 11-23-2007 06:17 AM
Can we put the reference dll in to a specific folder? amansundar C# Programming 3 10-29-2007 12:51 AM
Deleting file contents using php Archimedees PHP Programming 1 09-20-2007 02:44 AM
can i format the hard disk without deleting some files saravanan Computer Hardware 3 09-04-2007 06:11 AM


All times are GMT -7. The time now is 03:02 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0