Delete Row In Database By A Selectbox?
I'm having a world of trouble with this. I have a selectbox of names....when they selectone and hit delete I want it to delete it from the database. I dont think i'm getting any value from the select box. Here is the code I have : PHP Code:
View Complete Forum Thread with Replies
Related Forum Messages:
SelectBox And PHP
I have the following: <select name="options"> <option value="10">number10</options> <option value="20">number20</options> </select> If I want to print the choice I would use $_POST{'options'} and the $_POST{'options'} would have values of selected choice(10,20) But how can I print the selected text,not value(number10,number20) or do I have to use JS for that?
View Replies !
Resetting Selectbox
I've come across a problem while making a posting system on my website. I would like to have my select box so that the user can add some coloured text into the post by choosing an option from the drop down box, causing text to be added to my textarea "combox" and then have the combobox reset to the default value (the Font Color selection) but after trying various code from googleing, Code:
View Replies !
Selectbox Varible Into A Query
I have a Invoice generated from a MySql database with a dynamic select box that is populated with Invoice_ID My question is how to pass what is selected into my query. My query is one the same page as the select box. selectbox is populated with data from Invoice_ID column example: Invoice_ID| 1 2 3 4 5 My query: $query = "SELECT * FROM Customer WHERE Invoice_ID=1"; How do I change the 1 to whatever is selected and do I need to have it pass back and forth between two like pages? or do I need a button to cause action on what is selected.
View Replies !
Update Row With 0 When You Uncheck A Selectbox
I'm having a form that gets the variables out of the database, i have 2 checkboxes and one of them is set as selected. Now i'm trying when you unselect the selected box and press on submit that the row will be updated with 0 but i cant get it to work. PHP Code:
View Replies !
Delete From Database
I have code that does not delete from a database. The same code (cut an paste in the same file, but different function and having a different query) works. So, of course, I tested the query interactively. I echoed the query and did a cut and paste when interactively connect to the database. That one worked so it isn't the query since interactively it is seeing exactly the same thing as the code produces. Here is the code: function deleteCatalog($catalog) { $query = "DELETE FROM CatalogNames WHERE sCatalogID='" . $catalog . "'"; mssql_select_db($database_Login, $_SESSION['Login']); $result = mssql_query($query, $Login); ... } The $query echos: DELETE FROM CatalogNames WHERE sCatalogID='CMP' As an example of code that works (in the same file) function addToCatalog($cat_id, $cat_name) { $query = "INSERT INTO CatalogNames (sCatalogID, sCatalogName) " . "VALUES ('" . $cat_id . "', '" . $cat_name . "')"; mssql_select_db($database_Login, $_SESSION['Login']); $result = mssql_query($query, $_SESSION['Login']); ... } The second and third lines are identical (cut and pasted) as in other places in the same code. In fact, it is only in this file that I do all the database work. Every other function works. This is the only delete, however.
View Replies !
Delete Database
using php and mysql how can i tell the my website to move any entry older than 30 days to a different table and then delete it below i have some script i did try but this doesnt work (im using unix timestamp incase that changes anything) mysql_query(" INSERT INTO newsarchive (id, postdate, title, newstext) SELECT id, postdate, title, newstext FROM news WHERE postdate < DATE_SUB(curdate(), INTERVAL 30 DAY)"); mysql_query("DELETE FROM news WHERE postdate < DATE_SUB(curdate(), INTERVAL 30 DAY)"); mysql_close($link); //clean up
View Replies !
Recursive Database Delete
I have two tables in my database, one for the folders, where each folder has a parent id and an id itself, and one for the files where each file has a parent id for the folder its in. Now If the user deletes a folder, every file and folder within it, no matter how many there are, should be deleted. Can anyone give me the idea?
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 !
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 !
How To Delete MySQL Database.
I've got three hostings with the GoDaddy hosting service. The hostings are supposed to provide only one MySQL database each. I've just recently noticed in the phpMyAdmin program that separate databases, each with the name "test," has appeared in two of the three hostings. I don't know how they got there. I didn't put them there. I contacted GoDaddy's technical support. They said that the "test" databases automatically comes with the phpMyAdmin program. Of course, that's not right. Anyway they said that I could delete the extra database without damaging anything.
View Replies !
Delete Data From Database
Let's say i have two tables, table_one; userid,userinput,indexno table_two; cond,qant,amp,indexno the indexno in table_one and table_two are the same.if i choose to delete one row of data in table_one,i want the data with the same indexno in table_two be deleted as well. how can i achieve this?
View Replies !
Database Auto Count What About Delete?
I have a table that give a unique ID to certain Articles. To give the ID i simply use the Auto count of the DB. But what happens when i delete a record? i am now missing an ID. How can i insert a row and give it the first available number? For example ID 1, 2, 4, 5, 6 i would Insert and set the ID number to 3.
View Replies !
Delete Data From MySQL Database
I am new to PHP and MySQL but I have setup a MySQL database. I can view the information in an HTML table using PHP scripts and can delete an entry form the database table, but what i need to do is to be able to delete an entry by selecting a radio button next to the relevent information however when i try to add a form in the PHP script i get an error.
View Replies !
Database Update/edit And Delete
i have spent the last few days trying to create a simple script to add/edit and delete entries in a mysql database with php. i have 1 database with 40 tables, each table has 3 fields (id, header and body) i created an input page with input fields for header and body. the table to store the information in is selected from a drop down menu. all this works fine. for some reason i cannot get the edit and delete page top work at all. would someone mind taking a look at the code and let me know what i am doing wrong? Code:
View Replies !
Delete From Flat File Database ?
I have recently started to code a Flat file database (just for fun) and it's going fine, but I was wondering whats the best way to delete a line from the file. I have this code below and I would like to add a delete button besides each line, which would obviously delete that line. But I do not know the best way to go around doing this as I don't know any specific functions to use. Code:
View Replies !
How To Delete All Database Entires Older Than 30 Days?
One of the fields in my database is called ad_date which is of date type and stored dates int he format YYYY-MM-DD. I would like to perform a DELETE SQL statement in my PHP script which deletes all records with an ad_date value older than 30 days. I knoy this is also an SQL question, but it is the 'older than 30 days' part which I'm stuck with and so figured it would be better in the PHP forum as I think I need to use PHP to calculate todays date - 30 days.
View Replies !
Simplify Insert-update-delete From Database
I'm looking for some functions or objects allowing to select-insert-update-delete from any table in a mysql database without the need to create a new query every time. Example: selectdatas(array('field1','field2','fieldn'),arra y('table1','tablen'),array('left join,idy','inner join, idx')) then the function build the query, execute it and then return an object with the query result. I must build a database driven site that is 90% of the time spent on building queries. If I may avoid build them manually it will help me a lot and let me gain some days of programming.
View Replies !
DELETE TimeOut Issue On A Large Database
When I run the script below, it results in a timeout. Running the commands through phpMyAdmin, results in a timeout too. Table1 has 40,000 records and Table2 has 35,000 records. I run the script to get rid of the duplicates. Is there a way that I can check for duplicates without the timeout issue? I tried the while loop through PHP and that results in a timeout too. Code:
View Replies !
Delete Database Base On User Choice
i want to let user delete their data from database. Note: one user may have more than one rows of data. table as following; TCid UserName Topic Content 1 q1 aa aa 2 q2 aa aa 3 q3 aa aa 4 q1 aa aa 5 q2 aa aa And i code as following steps; 1) ask user input user name 2) Display out all the data which the users got. (it is in delete.php file.) in here, i will use the check box, to let the user choices which data they will delete. note: i will try to make the Cid relate with the input name, so later on i can delete the data base on Cid. 3) i will delete the data base on the user choice(it is in deleteR.php file). but at the movement, i just want to test where i can get the value of the TCid or not (because i will delete some datas base on the TCid which the user choiced). The problem i go now, it is from the step 3, i could not get the TCid's value out, that's mean, i could not delete some data base on the user choiced. Code:
View Replies !
Delete Multiple Records In The Same Database Querie?
I have some code that deletes records from the database, in a loop. However its prety inificient as it makes a seperate database call in every loop whcih is slow. PHP Code: for ($i=0; $i<count($idarray); $i++) db_query("delete from clicks where id='$idarray[$i]'"); Is their a more efficient way of doing that? It is posible to delete multiple records in the same database querie?
View Replies !
Simple Login Page To Delete And Edit Things In Mysql Database
How do I build a simple login page on my site? I need a way to login to my admin area in my webshop, so I can add, delete and edit things in mysql database. I don't need help with add, delete and change things, only the login thing. The users should not even know that there is a admin login page. The users don't login to shop, they just shop so I can't use the user login page because there is no such page. Can someone please give me some guidelines for this?
View Replies !
Delete Record - When The Delete Link Is Clicked The Next Page Is Blank And Nothing Is Deleted.
This is my "delete.php" and this "todo/delete.php?id=64" an example of a link to it generated from the index.php page. When the delete link is clicked the next page is blank and nothing is deleted. What have I done wrong? <? include("dbinfo.inc.php"); mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $id="delete from todo where id='$id'"; mysql_query($id); mysql_close(); ?>
View Replies !
Mysql Delete - $query = Mysql_query("DELETE
how would i do the following ? $query = mysql_query("DELETE notes, datestamp, abs_value, ID FROM absence_mgt WHERE datestamp='$date' AND ID='$vtc_login' ") or die(mysql_error()); im just getting "Unknown table 'notes' in MULTI DELETE" ?
View Replies !
DELETE RECORDS - Database Adding New Records
iv got the database adding new records, and now I want it to display all of the records that are there buy name and id number, then i want u to be able to type in the id number of the customer u wish to delete and it shoudl delete it, sounds good buts its not actually deleting the record. it says it does, but its not doing it. Code:
View Replies !
Delete From $var
Is it not possilbe to have a variable for the table name in a delete statement (mysql database). inside an if this button is hit statement I have: $sql = "delete from $type where id_num='$number'"; mysql_query($sql); echo "$sql"; when it echos $sql it doesnt have the $type var where the table name should be, it just leaves that blank.
View Replies !
Delete A Row
This should be simple enough but for some reason it's not working. The $name is a number which is being posted across when the user clicks submit. I want the PHP to then access the Database with this number and use it to delete the staff ID (which is a PK). With this code I get the error: Warning: ociparse(): supplied argument is not a valid OCI8-Connection resource in /homedir/ilex-s01/jmsuther/public_html/DeleteStaff.php on line 16 Warning: ociexecute(): supplied argument is not a valid OCI8-Statement resource in /homedir/ilex-s01/jmsuther/public_html/DeleteStaff.php on line 17 ; The code is: $name = $_POST["staffnodelete"]; IF ($staffnodelete=="" ) {print "You selected $name - for deletion ";} putenv("TNS_ADMIN=/u1/oracle/Products/shu10g/network/admin"); $con = OCILogon("username","password","10g"); $query = "DELETE FROM staff WHERE staffno = $name"; $query = $query_post [$name]; $stmt = ociparse($conn, $query); ociexecute ($stmt);
View Replies !
Not Able To Delete
I've written a script to display all records in a database table and allow the user to select a record for deletion by entering it's ID number into a form at the bottom of the page. When they click on the Submit button, it refreshes the page & shows the entire record that they selected and it asks if they're sure that they want to delete it. There's 2 radio buttons that that allow them to select either "Yes" or "No". Everything is working fine up to that point. Where I run into problems is that no matter whether they choose yes or no, the record does not get deleted.
View Replies !
Delete Row
I am having a little problem with the following row to delete a row from my table. This script works fine on my home testing server but as soon as I put it onto my main web server it does not work and gives me an SQL syntax error. PHP Code: mysql_select_db($database, $connect); $sql = "DELETE FROM prices WHERE id=$id"; mysql_query($sql) or die(mysql_error());
View Replies !
Row Delete
what i am trying to do is delete all rows except for the last 20 rows, anyone know how this can be done? basically i am keeping track of profile views so i know what members lasts seen who... my questin is how do i delete all but that last 2o for each $Member?
View Replies !
Delete
In one part of a review site i am making it allows top level users to make reviews witch includes uploading a picture and then changing the name to [name of review].[whatever], also it allows people to edit the review and change the picture, how exactly would i go about getting rid of the old picture so that i dont have to do hours of clean up.
View Replies !
Delete From Dir....
I have a field named 'path' in my db that has the exact same number(path) as its counterpart folder under cart/zips. So my path in my db might be �', and in cart/zips you'd have the folder 23423423. There is a corresponding session with each 'path' row. Based on the session, I want to retrieve the path name and delete its counterpart folder name (and all it's sub-files it may contain). The delete_all_from_dir function below is deleting the whole zips folder when I only want it to delete the path folder below it and its contents. Code:
View Replies !
How To Delete Fields
I would delete with php, all record of a table mysql where the seven left chars of the field is equal to the data in input($seven_chars). I have used the the belowe istrucrion but it do not work.how can I do? mysql_query ("DELETE FROM my_table WHERE substr(myfield,0,7)=$seven_chars");
View Replies !
Delete A Line In PHP
What i want to do is to open a file read the file Select a particular line from the file and delete that line and close the file. How to do it in PHP.
View Replies !
Can't Delete Cookie
Right I am quite new to php but have managed to create a simple log in/log out thing with cookies. All was working fine and as expected until I added a new section of the site. The new section stores another cookie (latest message user has read) so that next time they visit the site it will highlight the 'new' messages. However since adding this I can no longer log out.
View Replies !
Can't Delete Cookie, Help Please~
Page1: <? setcookie("book_id", $book_id ); ?> Page2: <? setcookie ("book_id", $book_id, time() - 3600); ?> Can't delete cookie at once but reload page 2 two times how to delete $book_id cookie without reload?
View Replies !
Cookie Won't Delete
I'm trying to setup a simple user authenication for my site. I'm using cookies to pass the credentials between pages. But the function header() is giving me problems logging in and logging out. As you can see in the code below, I try to redirect the user to a page after setting or deleting the cookies. The scripts redirect okay, but the user never logs in and never logs out correctly. The scripts works correctly (logging in & logging out) only if I comment out the header() function. Here's my code for setting the cookie (login.php):
View Replies !
Delete All Replicated Except One
I ran PHP codes that creating tables and inserting records to tables., But something happened, someone of them is inserted more than once. aa1345 | Ninsonoto aa1345 | Ninsonoto aa1348 | Ayumi Tohina aa1348 | Ayumi Tohina aa1348 | Ayumi Tohina There are thousands of records there. So I think i have to write a script that able to delete all the replicated except one.. e.g : Delete four of aa1348 records.
View Replies !
Delete New Lines
I would like to delete the new lines, I mean the, so Itried this: str_replace($row['facts_conten t'], " ", "") ; But the new lines are still there, how can I do?
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 !
What Is The Best Way To Delete File ...?
I have script that allows a user to upload a txt file for processing, filtering, to save bandwidth,instead of user reuploading the file everytime he/she does a new process on the same file, i save the file to the server, and process from that file. What I want to be able to do is, when the user uploads a new file, or leaves the site, this temp file is automatically deleted (saves disk space).
View Replies !
SQL Insert And Delete?
Anyone know if there's a way to call a query but remove whatever you grabbed from the database, or would I have to do a query to retrieve what i needed, then follow it up with a delete on the same query results?
View Replies !
Delete An Object ?
I use OOP with PHP4 and i don't understand something. I have 2 classes VISIT & PLANNING like that: class clVISIT { var $when; var $where; //constructor function clVISIT($_when,$_where) { $this->when = $_when; $this->where = $_where; } } class clPLANNING { var $who; var $visit = array(); //constructor function ClPLANNING($_who) { $this->who = $_who; for ($i=0;$i<10;$i++) { $visit = new clVISIT("foo".$i , "foobar".$i ) ; } } } Ok, in the last constructor, we can see that i create new clVISIT object. My question is: how can i delete some of them in the same constructor ? is there a word like "new" but to delete ?
View Replies !
Delete Script
PHP and MySQL and I'm having some problems getting this script to work. I can't get this to work and I don't understand why. I don't get an error or anything, it almost seems like the page refreshes. I went to the phpmyadmin and the row is still in the database. The $_GET parts work perfectly in another script and the SQL statement works when I insert hard values in it. Any thoughts would be greatly appreciated. Thanks in advance. <form method="POST" action="<?php print $_SERVER['PHP_SELF']; ?>"> <table> <tr><td colspan="2" align="center">Yes <?php input_radiocheck('radio','yes_no', $defaults, 'yes'); ?No <?php input_radiocheck('radio','yes_no', $defaults, 'no'); ?> </td></tr> <tr><td colspan="2" align="center"><?php input_submit('save','Add'); ?> </td></tr> </table> <input type="hidden" name="_submit_check" value="1"/> </form> <?php function process_form() { // Access the global variable $db inside this function global $db; $isbn = $_GET['isbn']; $artist_name = $_GET['artist_name']; $album_title = $_GET['album_title']; if ($_POST['yes_no'] == 'yes') { $delete_sql = "DELETE FROM lounge WHERE isbn = $isbn AND artist_name = '$artist_name' AND album_title = '$album_title'"; // Delete the record $db->query($delete_sql); print "The record was deleted"; } else { print "The record was not deleted"; } } ?>
View Replies !
|