Listing Table Data With An Option To Delete Each Individual Item.
Was wondering if anyone could help me with a PHP, MySQL problem. I am
completely new to PHP and MySQL. I have been trying to find a way to
list data from a table on a web page and after each individual item
have a hyperlink to allow users to delete the information listed. Can
anyone help?
i.e.
Name Age Sex
------------------------------------------
Adam 21 M delete
Betty 22 F delete
Chris 23 M delete
Daisy 24 F delete
------------------------------------------------------------------------------------------------------------------------------
(delete after 'Sex' would be the hyperlink to delete that entire line
(row) from the table).
View Complete Forum Thread with Replies
Related Forum Messages:
Listing Mysql Results In A <select> Or Checkbox Item
I'm currently developping my own user system and so far I've completed my registration and profile but now I'm stuck on a problem at my edit file. I do'nt have a clue on how to insert mysql entries, like the birthday of the user back into the drop-down list (<select>) or options they choosed back into the checkboxes. Does anyone know how to do this? I do know how to put mysql entries back into textfields but I can't figure out how to do this for the other form items.
View Replies !
Delete Item From Database
I still can't figure out how to delete an item from my shoppingcart. I have tried different ways to do this, but its impossible. -a button or link that deletes a item from my database -the php script that deletes it here is a suggestion: $slett = "DELETE ID, VARE, MODELL, STR, ANTALL, PRIS, TOTALPRIS FROM USER_TRACK WHERE USER_ID = "$user_id""; But how can i assign this to a button?
View Replies !
How Do You Delete A File From A Listing Please?
I have the code: <?php if ($dir = @opendir("../project/proj_images")) { while (($file = readdir($dir)) !== false) if($file != ".." && $file != ".") echo "<tr><td align="left" class="bodyblue2">$file</td></tr>"; closedir($dir); } ?> which displays a list of files in a directory. What I want, is to be able to click on a file in the list and delete it. I know you use unlink but how do you tie it in with the above code?
View Replies !
Adding Delete Option
Have a look at this code found at Zend: http://www.zend.com/php/beginners/php101-8.php#Heading5 I've been trying to figure out how I can add a "delete" option next to every row result that comes from the quiery. There's a mini tutorial a little further down on that page but I would specifically like it for this structure of code. Also the mini tutorial is in mysqli instead of mysql.
View Replies !
Delete Option From My View Records Page
I have a list of things I need to do with my database - but this is my next hurdle - the delete query within my view records page. I want to be able to click on a button or link to delete a record in a table. I was envisaging that each record would have a delete button or link next to it and clicking that would remove it. Here is the script I have created to view "Devices": PHP Code:
View Replies !
How To Apply Css To A Table That Is The Only Item In A Php File Please
How to apply css to a table that is the only item in a php file please In the page that has just the one table that is to be included in the other 2 pages, there's some heavy css going on, plus the text in the table gets changed quite a lot on a daily basis. Usually, in my program, I can highlught the text that needs a different css applied to it and click on the css style that applies to it, but because the page only has the one table and nothing else, there's no mention of the link to the styles page?
View Replies !
Listing Table Contents
I have the contents of a table that I would like listed. The fields should be in a column with headings. Currently I have: PHP Code: $query = mysql_query("SELECT Date, Time, Keyword, Position FROM logfile"); while ($row = mysql_fetch_array($query)) { echo "<td><span class='style3b'>$row</span></td> "; echo "</tr> "; } But I am not getting the output I hoped.
View Replies !
Get A Listing Of The Fields In A Table?
mysql_query( "create table myTable ( field not null... etc )" ) and now I want to get a listing of those fields that I added because I want to be able to add and delete fields based on a different table. I tried doing mysql_query( "describe myTable" ) but all I get is the first row in the table, not all the fields I added. I get in my array (after a mysql_fetch_array call) field, int(11), 0(which is what is stored in the first field) and then I don't get any of the other fields in the table. Anyone know a way for me to get a listing of the fields in a table?
View Replies !
Drag From Table Listing And Drop Into Form?
I am looking to optimize a simple-sounding task that is actually quite inefficient for me. I have built a form with 32 fields; each field should be capable of accepting one of 5,000+ possible values. Currently, I use an SQL query to load the 5,000 values into a variable, building a <select><option> list. I then load these massive drop-downs into the form. As you can imagine, while the data is properly transferred, it takes forever for this page to render... it is over 4MB big! I need something more efficient... In my mind's eye, I picture downloading the 5,000 values once into a table on the right-side of the page; then clicking each desired value and dragging it to the form on the left, dropping it into any of the available 32 fields.
View Replies !
Get The Data For The Selected Item And Not The First It Comes Across?
I use the GROUP BY command in one of my queries, the trouble is although they share a common field sometimes the data differs in other fields for an individual record. Is it possible with the command to get the data for the selected item and not the first it comes across? For instance if the data is this ID, Cat ID, Name, Data 1, 1, Name 1, bla bl1 2, 1, Name 2, bla bl2 when grouping by cat id and group concat the name, irrespective of the id that is input to the database the query will deliver. Cat ID: 1 Name: Name 1,Name 2 Data: bla bl1 What I want is for the query to output 'bla bl1' when the id on the php page is 1 and 'bla bl2' when the id on the php page is 2. Is this possible? If the way I've explained it is confusing let me know and I'll try to make it clearer.
View Replies !
Listing And Separating Data
I have a database table that has the fields: ID, Date, Entry. What I want to do is to create an HTML file that will list the Date and Entry data. I am having problems because I don't know how to create an HTML file that will have a predefined HTML layout and will be able to add in the ENTRIES in there. So basically I want to create an HTML with a predefined layout. A user will have a form that will be able to add Entries and it will then update the HTML file, adding the new Entry into a specified location of the HTML file. Creating a file I know how to do, and displaying the data, I know how to do as well. But I also want it to only display 5 entries and once 5 entries has been displayed, it will create a new HTML file with the next 5 entries.
View Replies !
Select Data Into Option Box
Say I have a form <select name="Birth_Month"> <option value="">(Month)</option> <option value="01">Jan</option> <option value="02">Feb</option> <option value="03">Mar</option> <option value="04">Apr</option> <option value="05">May</option> <option value="06">Jun</option> <option value="07">Jul</option> The user selected one field, and that field's value is stored in the mysql database. My question is, if the user wants to come back to the page, and select "Edit". .. Then he/she should get a form that his Birth_month's value has already been selected for him. I did the select * query <?php echo "value="$row[6]"";?>> The $row[6] is the row that contain that user's month info. But I don't know how can I use that row to insert into those option box?
View Replies !
Best Way To Add A Sort Option For The Entered Data
Example: I have a books table in my database that has an auto incrementing id field, and a name field. I sort them by name automatically when posting to the browser. What is the best way to add a sort option for the entered data in the backend to be able to sort the books by moving them up or down? So I would be able to control what book would show first, second, third, and so on, in the list of books shown to the public for viewing. I have seen this feature in Mambo where you have the choice to re-number the items for sort order, and they typically have the up and down arrows that you can click as well. Would I just add another field called sort_order and store a number in that box? Or is there a better/easier way to do it?
View Replies !
Using Database Data For SELECT OPTION Statement
I want to use a <SELECT> / <OPTION> setup, and pull the data from a mysql database. I have done that, and don't necessarily have a problem with that. My problem is the database will have duplicate information in it, how do I only select one of each unique value? Code:
View Replies !
Can't Delete From Table!
I'm not to familiar to php and sql. I have this assignment to read from database in a table and I HAVE TO be able to push a button causing one costumer to vanish. something to do with id = $id... can anyone help me... and help me fast! This is my code:
View Replies !
Delete From Table
I get this error not sure what's wrong? Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VALUES ('mortalsombat@hotmail.com')' at line 3 Code:
View Replies !
Delete Row From Table
I know that we're not really meant to request stuff, but I cannot do this script on my own. I need the bellow code to add delete links in the table so that the user will be able to delete requests. Code:
View Replies !
How To Delete A Table
I just need to know how to delete a table. Not its contents I know how to use the query DELETE FROM but how do I do the DROP TABLE one? the table name is "Events".
View Replies !
Listing Date - Creating Permanent Listing?
I have a script that has a drop-down for how long the listing will be published. Right now, it uses the following to decide between 2 weeks, 1 month, 3 months, or 6 months: $cadate = time(); if ($gueltig == ཊ')$caend = $cadate + 1209600; elseif ($gueltig == ཚ')$caend = $cadate + 2592000; elseif ($gueltig == ྖ')$caend = $cadate + 7776000; elseif ($gueltig == 餎')$caend = $cadate + 15724800; else$caend = $cadate + 1209600; $deltime = strftime(""._CLADS_STRF."",$caend); I know this is a stab in the dark, and without seeing the rest of the code, is there another elseif I can add so that the listing will be there permanently?
View Replies !
How To Auto Delete Table Row?
I Have A Page On My Site That The Database Outputs To. There Is A User That I Dont Want To Ban Yet , But I Do Want To Block Or auto Delete His Data. Now When Everyone Post New Data The Only Table That Would identify Them Is The Username Table, There Is No Member ID Table. Now I Would Like To querry The Database And Auto Delete Table (Username) BOBBY And The Row BOBBY Posted , So There Is No Data Output To My Site Page For BOBBY. Can Someone Give Me A Couple Codes To Try, And I Would Think The Code Would Need To Be On A New Page That I Need To Make Up Right?
View Replies !
Delete A Row From A Database Table
I'm trying to delete a row from a database table. I've made a connection yet it's not working. Is there something wrong with the following code? mysql_query("DELETE * from `contactinfo` WHERE Submission_Number = 1 ");
View Replies !
Delete Records From A Table
I have a table its called queue. It has a field called id. I want to delete all records in the table apart from the ones with id equals to 74 or 75 or 87. How do i do that?
View Replies !
Delete Records From Table 1
I have a script that doesn't delete records from one database when it should, and now I have to do this myself because database is big and causes problems on the server. What I have is: TABLE 1, field auction TABLE 2, field id so I would like to delete all records from TABLE 1 where the value of the field auction doesn't match the value of the field id in TABLE 2. Can someone help me on this, please? I need to get this database cleaned.
View Replies !
Insert Into New Table And Delete From Old
I've got 2 tables of users: 'pending' and 'approved'. The first table (pending) is a 'holding' table for unapproved users and when the user is approved I can click on a checkbox by their name and copy them over to the approved users table (INSERT INTO approved...) This all works fine but I'd also like to delete them from the 'pending' table at the same time. How would I do this? Something like (INSERT INTO approved, DELETE FROM pending)? I'd do a bit of trial and error but since it's on a live site, I don't want to muck it up and not be able to fix it! Code:
View Replies !
Delete Table Contents?
ive got a table thats too big to dump the records in myphpadmin, how can i dump all the fileds (i think there are 4 or 5) but keep the table and fileds intact to be used again?
View Replies !
Multiple Table Delete
I have 3 tables that all have b_id in them. Blog table has b_id, title,author,body,date then I have a tags table that has t_id,name,b_id_blog and a comments table that has c_id,c_body,c_name,c_email,c_url,b_id_blog. My question how can I remove all data from the 3 tables based off the b_id?
View Replies !
Delete Selected Records From Table.
Can anyone see why this connection doesn't work? It's suppose to delete selected records from my table. <?php if (isset($_POST['delete'])) // && isset($_POST['delcus'])) { foreach ($_POST['delcus'] as $val) { echo "$val"; $conn= mysql_connect( "localhost", "user", "password" ); $sql = mysql_select_db( "snow" ); $del = mysql_query("DELETE * FROM request WHERE qid =" .$val); //$rows = mysql_num_rows($del); $rs = mysql_query($conn, $sql, $del); if($rs) .........................
View Replies !
Delete Something From A Table Using A String Variable.
Basically, I am trying to delete something from a table using a string variable. $tsremove = "Available for All Windows Platforms"; $tscat = "solutions"; mysql_query("DELETE FROM techspecs_'$tscat' WHERE '$tscat' = '".$tsremove."'"); So the mysql_query should be DELETE FROM techspecs_solutions where solutions = "Available for All Windows Platforms";
View Replies !
Delete Data From The Data Base
Im doing the PHP-MYSQL program to search the data in the database and display on the HTML Page. Everything is working fine till now. Now I want to know that, how to write program to delete the searched and displayed data from the database..... I know the MySQL Syntax to delete data from database...Im not asking about MySQL programming. I want just an idea, how to do the delete process. Here is My full PHP script, Code:
View Replies !
Delete Textfile List From MySQL Table
I have a list of email addresses that I need to delete from my database and they are in a textfile, one on each line like below... a@b.com c@d.com e@f.com etc. does anybody have a snippet of PHP code that I could use to accomplish such a task?
View Replies !
How Do I Delete Selected Rows From MySQL Table?
I am trying to figure out how to delete selected rows from a MySQL database table. The web site that I am working on has a page that will extract rows, using the "SELECT * FROM .. etc." statement from a database and output them in a table - like the one below (bottom part). I've got that part figured out. What I am trying to figure out is if the user puts a checkmark in one of the checkboxes (below) how would I write the PHP code to delete one or two of the rows from the MySQL table? PHP Code:
View Replies !
Commands To Delete, Recreate And Repopulate A Table
I am in the middle of an assignment at uni which has lots of tasks which will eventually create 4 different dynamic pages. On one of the pages, I need to create a script to open a file containing MySql in it. The MySql has commands to delete, recreate and repopulate a table. I currently have; $handle=fopen("filename" , "r"); $lines=file("filename"); but I'm not entirely sure where to go from here.
View Replies !
Multi Table Insert Delete Select Function Needed.
I am going nuts here and I know with all the functions out there, there must be an easier way to do this. Maybe someone can point me to the right tutorial or even show me how to do this. I have a $main_id and many $sub_id tables and like to “SELECT to view” INSERT and DELETE those. UPDATE must not be but would be nice. Here is how it looks:
View Replies !
Delete Data
i try to delete the data by hit the delete button. but no changes. here i submit my coding. PHP Code: <?php if (isset($_REQUEST['delete'])) $select ="DELETE from details where amount = $nt[amount]" ?>
View Replies !
Using PHP To Sort Data In MySQL Table 1 By Values In Table 2
I have a MySQL database with 2 tables in it. products and prices.. Products has a field in it called 'prodno'. Prices has a field in it called 'prodid'. There is one of each item in products and each product has it's own unique 'prodno' There are multiple instances of each product's pricing in prices.. One for each price.. So if a product had multiple prices depending on quantity it would have an entry for each price.. Example: id = 1 prodid = 7001 qty = 300 price = 12.5 id = 2 prodid = 7001 qty = 400 price = 15.5 I was wondering if I could query the database getting info from the products table but sort it according to the prices in the prices table. Kinda like doing a "SELECT * FROM products" ordering it by the lowest price value from each item.. This is all very confusing to me, and I'm the one writing it. Let's try one last time.. Query the database selecting * from products (I plan on using all the info in products) and ordering them by the lowest price for each item in the prices table. I've tried sorting the results of just a basic SELECT * FROM products using Javascript and PHP but with pagination in the results it makes it a bit hard.
View Replies !
Showing Data From A Table Based On Infos From Another Table!
i have 2 tables in my database : THREAD, and POST THREAD's rows are: THREADID, TITLE + FORUMID + REPLYCOUNT + VIEWS POST's rows are: THREADID, PAGETEXT and PARENTID i'm a big php newbie... I want to display the LAST TWO messages (highest THREADID) of my forum number 99 (FORUMID=99). I can probably do that, but the problem is that the text of the message is located in another table.. and it's getting too hard for my low-skilled brain lol so basically I would like to check in "THREAD" for the highest THREADID where FORUMID=99, display the TITLE, REPLYCOUNT and VIEWS, and then check in POST for the same two THREADID's where PARENTID=0 (meaning it is the first message in the thread) and finally display the PAGETEXT ! Could anyone give me a PHP code that would display that?
View Replies !
|