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 Complete Forum Thread with Replies
Related Forum Messages:
- Simple Login Page To Delete And Edit Things In Mysql Database
- Simplify Insert-update-delete From Database
- FFDB Edit And Delete
- Edit Delete Form And Quotations
- How To Do Insert,delete,edit Using Ajax
- Define Files For View/edit/delete
- Edit/Update Db
- Edit/update - All In One PHP Pages?
- How To Edit/update Timestamp?
- How Can I Retrieve, Edit, And Update Text?
- Simply Edit And Update Script
- Edit Page To Update Tables
- Update Without Delete
- OOP Page: Where To Put Update, Insert, Delete
- Php/mysql Insert, Update, Delete All-in-one
- Update, Delete And Insert Values
- Basic Delete/update Script
- Insert, Delete, Update And Query Data Via DBX
- Edit The Entries In The Database
- Edit Data In A Database
- Update Query - How Do You Update A Value In The Database In A Certain Row?
- Edit Details From Mysql Database
- Edit The User Information In The Database
- Edit Flat File Database
- Automatically Update Database On Server Usign Php.e.g Mysql Database
- PHP Flat File Database - How To Load And Edit Lines?
- Delete From Database
- Delete Database
- Recursive Database Delete
- Delete Item From Database
- Delete Row In Database By A Selectbox?
- Delete A Row From A Database Table
- How To Delete MySQL Database.
- Delete Data From Database
- Update A Database Based On Another Database
- Mark A Row In My Mysql Database As To Be Delete
- Database Auto Count What About Delete?
- Delete Data From MySQL Database
- How To Delete Multiple Entries From Database?
- Delete From Flat File Database ?
- Using Checkboxes To Delete Record From Database
- How To Delete All Database Entires Older Than 30 Days?
- How To Delete A MySQL Database Table Without System()
- DELETE TimeOut Issue On A Large Database
- Delete Database Base On User Choice
- Delete Multiple Records In The Same Database Querie?
- Database Delete Repeat Records And Add Up Totals
- It Wont Delete The Entry From The Database. The Page Just Refreshes?
- Update A Database Row.
- Database Won't Update
- Update Database
- Automatic Delete From MySQL Database Table Expired Records?
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 !
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 !
FFDB Edit And Delete
I've got a news program that you can upload the new news via a form, puts the data into a text file etc. I'm trying to find a way to delete certain lines from the txt file and to be able to edit them. I've played around with a few things but i just can't seem to get anything close to what i'm after. I've looked around the web but all i can find is like "open the file > put into array > do what needs to be done > write back to the file" which isn't exactly that helpful. Could anybody point me in the right direction as to how to do this? maybe with a better description/example? =D
View Replies !
Edit Delete Form And Quotations
I have a form where I add a lot of ' and " for feet and inches into MYSql and most of this works fine except when I go back to the Edit/Delete Form. It stores the ' and " in the database, reads and outputs the ' and " on my page but when I use the edit/delete form it cuts off at the '. Is there a simple solution to this on an edit/delete form ?
View Replies !
Define Files For View/edit/delete
I am working on this little file manager project, I know, there's lots out there. However, I couldn't find one that paged the results that didn't use a DB. Now that I have it set up (works great), I'm not sure how to define the files and not mess up the paging - so that if it's a folder you can open it and work with the files, a photo you can view or delete it and if it's a .txt, .php. etc. you can edit it. Code:
View Replies !
Edit/Update Db
I'm a complete newb and im not sure how I should go about the following: Retrieve data set from the db and display in a table - Easy enough Allow user to edit fields in table based on user credentials Update DB with contents of table The bit that im finding tricky is the editing of the table data and how to get this to my page to form the SQL statements.
View Replies !
Edit/update - All In One PHP Pages?
Let me explain how I'd generally do things. For a page where the user edits data, I'd generally call it something like editfred.php (for example), the page which updates the data would be called updatefred.php and equally the page which processes a delete would be deletefred.php. I like splitting the pages up this way, it feels less cluttered and more organised than throwing all the functionality in one fred.php. Here's the problem though. If the user enters erroneous data into the form editfred.php which is subsequently processed by updatefred.php then that error needs to be reported to the user. Traditionally what I've done is have updatefred.php list any errors it finds and then provide a link to go back or ask the user to hit the back button on their browser. This is no longer viable, instead I'd like to automatically throw them back to editfred.php with all their data already filled in and the fields causing errors to be highlighted. My question is: what's the best way to do this? There springs to mind several ways: 1) combine editfred.php and updatefred.php. Again, I'm not keen on this but it does seem the most logical and programatically easiest. 2) use sessions to store the data, editfred.php would then check for data in the session each time it's loaded. Is there a maximum data size for use with session objects? 3) write code to wrap and store the data in a cookie which could then be read by editfred.php, similar to sessions I believe. However max cookie size is 4Kb which wouldn't be enough on some forms. 4) store the data from editfred.php in a table in the database which again editfred.php would check for when loaded. overhead of db access each time however.
View Replies !
How To Edit/update Timestamp?
I have tried the sql query below but it didnt work: mysql_query("UPDATE `php_blog` SET `timecode` = '".mktime (0,0,0,10,31,2006)."' WHERE `id`='1'"); The browser returned: QuoteCan't modify the column 'timestamp' to the table 'php_blog' in the database. Query was empty I am trying to change the timestamp manually.
View Replies !
How Can I Retrieve, Edit, And Update Text?
I'm trying to retrieve a text value from a MySQL database, put it into an updateable form, allow edits, and send back the edited text back into the MySQL database. I've been able to successfully retrieve the text and put it into the editable form, using htmlspecialchars function. But, I can't find a way of accepting the edited text and sending back to the database. Here's my code for retrieval. <?php @ $db = mysql_connect('localhost', '<database>', '<password>'); if (!$db) { echo "Error: Could not connect to database. Please try again later."; exit; } mysql_select_db("<database>"); $query = "select * from albert where ".$searchtype." like '%".$searchterm."%'"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { $title = $row['title']; $teaching = $row['teaching']; $teaching = wordwrap($teaching, 60, " ", 1); $teachnum = $row['teachnum']; } if ($result) { echo '<textarea name="newteachnum" rows="1" cols="4" wrap="off">' echo htmlspecialchars($teachnum)." "; echo '</textarea>' echo '<textarea name="newtitle" rows="1" cols="60" wrap="off">' echo htmlspecialchars($title)." "; echo '</textarea>' echo '<textarea name="newteaching" rows="20" cols="80" wrap="on">' echo htmlspecialchars($teaching)." "; echo '</textarea>' } ?> <form action="teach_update.php" method="post"> <input type=submit value="Submit"> </form> Here's the code to update the database. <?php @ $db = mysql_connect('localhost', '<database>', '<password>'); if (!$db) { echo "Error: Could not connect to database. Please try again later."; exit; } mysql_select_db("<database>"); $newtitle = addslashes($newtitle); $newteaching = addslashes($newteaching); $newteachnum = addslashes($newteachnum); $query = "update albert set title =". $newtitle . " and teaching = ". $newteaching . " where teachnum =" . $newteachnum ; print $query; //the print shows nulls for $newtitle, $newteaching, and $newteachnum. It seems like those values are not being held in memory from the calling program teach_edit.php //$result = mysql_query($query) or die("Could not update!"); // if ($result) // { // echo mysql_affected_rows()." text item updated into database."; // } ?>
View Replies !
Simply Edit And Update Script
Can anyone provide a simple edit/update script. I have only one field that requires updating and the structure is as follows: user_id = username User_password = password url = redirection url I would like to have th option to edit these three fields and I have tried everything. Can anyone help with a simple script?
View Replies !
Edit Page To Update Tables
Ok i have 2 pages here.. An edit page and a send edit page. Problem i'm having is when i hit adjust(submit) the values goto the next page but do not update the database tables that i have I think it's my update code that I'm using.. but i'll post both pages Code:
View Replies !
Update Without Delete
If i get a user to fill in a form that will update acurrent record, the user may leave a field blank, if field is not manditory, when you do an update, the blank field will over write the current data if there was any, is there a way round this?
View Replies !
OOP Page: Where To Put Update, Insert, Delete
I have a page that shows info from MySQL. It is for an online education site. It uses different classes arranged in a hierarchy. Each lesson is roughly laid out like this: Lesson |-Intro | |-Section | |-Procedure | |-text, video, images | |-Section | |-Procedure | |-text, video, images | |-Summary I have all the classes working properly for displaying info from the database. Now I am building the admin site. Where should I put the update/insert/delete code? Would those go inside the classes? Should I use the lesson object when doing the maintenance? Or, should I just have a separate page that handles the database stuff and only use the objects to display the data from the database?
View Replies !
Php/mysql Insert, Update, Delete All-in-one
I have a check box form in an admin area, that links various related tables into one. These check box results are stored in an array, and then looped, there are in fact four groups of arrays, but the array length could become large (i.e. dozens - not hundreds) The issue I have is that from the one form multiple things need to occur. - If a box is checked and the record doesn't exist a new record needs to be inserted. - If a box is checked and the record does exist, it should be ignored (as it already exists). - If the box is unchecked and the record exists, it should be deleted. - If the box is unchecked and the record doesn't exist it should be ignored (the record doesn't exists). I'm looking for the logic and process (rather than being hand fed code ) Can this be done with 1 (or more likely 2) sql statements. Or do I have to loop thru the arrays, checking the existance and then applying a specific sql statement depending upon checked status and the records existance. Someone mentioned using IF() in the sql statement, but I am not familiar with that one.
View Replies !
Update, Delete And Insert Values
i am looking for a code example for how to update and insert values into an existing xml doc. i know how to read from it but i couldn't find any materials about how update, delete and insert values to xml. i want to use simplexml.
View Replies !
Basic Delete/update Script
i am trying to do is delete a user off the database, via the admin menu. when the user is deleted the database is updated: this also be done using a HTML form, where when the admin type in a name and the user is located, the form then ask's if the admin would like to delete the user.
View Replies !
Edit The Entries In The Database
I have a script that allows you to edit the entries in the database. All is working fine except when you pull up an entry for editing the subject field only prints out the first word of the subject??? I know the entire subject line is in the database, but only this part of the script won't print it out. All the other fields work fine. Code:
View Replies !
Edit Data In A Database
I am using PHP4 and Access, i can output the info to the screen but i then want to be able to edit it. The code below does this using MySql, basicaly i need the equivalent for odbc. I think i am looking to change these functions: mysql_affected_rows(), mysql_query() and mysql_fetch_array() After looking at the php manual i found this one odbc_fetch_array(), but not the other 2. Any ideas anyone? Code:
View Replies !
Update Query - How Do You Update A Value In The Database In A Certain Row?
I am trying to make a little thing that allows you to edit something that you have previously submitted to be in the database. How do you update a value in the database in a certain row? Right now when I run my script, it submits the updated info into into every row in the database. How do I just make it so it inserts it into row x? (x being some random number that I will have passed to it).
View Replies !
Edit Details From Mysql Database
What i want to do is edit details that have been taken from mysql database and display them in a text box. I'm under standing what I’ve done so far which was to bring the job id code of the job that i want to edit from another page and i no the code to edit but what i can’t do is display the job data into a text box so it can be seen and edits can be made. All the books and website and forms I’ve read don’t show how to display the data to a text box or it’s so complicated that i don’t have a clue what’s going on? Code:
View Replies !
Edit The User Information In The Database
I am using php to write a login script.I have create a database to store user registration information..well done..I can register and all the data stored in the database well. BUT I wish to edit the user information in the database..how can I do it? Where can I get these example of source code.
View Replies !
Edit Flat File Database
I am looking to edit a record set in a flat file database. The user clicks on a link with an id to the page events_edit.php. I am trying to have it so that it can get all the information related to that id and then I can put it into the value="" field in the html. I Will then have to work out how to make it update.
View Replies !
PHP Flat File Database - How To Load And Edit Lines?
I am using a text file as a database, each field delimited by || I want to be able to print all lines to a page, then by selecting one (with, say, a radio button) it will load into the form at the bottom of the page, where I can edit the fields, and save back to the same line in the text file. I dont know how to use primary keys or anything with a text file database,
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 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 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 !
Update A Database Based On Another Database
I need to update a database based on another database. I can already run the php code to make the update file, but I have to remove an 'or' option at the end. This is what i have: PHP Code: <?php require("db_info.php"); $db=@mysql_connect("$host", "$dbuser", "$dbpass"); @mysql_select_db("$dbname"); echo("update phpbb_users set user_active="0" where"); $result=@mysql_query("SELECT * FROM members WHERE disable=1 ORDER BY rank DESC, myname"); while($row=@mysql_fetch_array($result)) echo(" username="$row[myname]" or "); ?> I realize that i'd have to open the other database up, but I'm not sure if I have to close the first db's connection before i open the second database up.
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 !
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 !
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 !
Update A Database Row.
I'm trying to update a database row. I don't know if there is something wrong with my PHP or the mysql query. mysql_query("UPDATE `playerranks` SET player_points=player_points + $Amount WHERE player_name=$Player_Name"); all my variables are set to the desired value.
View Replies !
Database Won't Update
I have written an application locallly that updates a database but when I moved the database files to the remote hosting server along with the php files, the database will no longer update or sometimes only update part of the fileds.
View Replies !
Update Database
I have a table with following structure. This table is to keep records of which titles the member has on his list. tablea: ID title checked. I pull records from the table and display them. He can check or uncheck the results and submit the form for update. <form method="post" action="<?php $_SERVER['PHP_SELF']; ?>"> <?php $result = mysql_query("SELECT ID,title,checked FROM tablea") or die(mysql_error()); while ($row = mysql_fetch_array($result)) { extract($row); echo "$title"; echo " "; echo "<input type="checkbox" name="checkbox[]""; if ($checked==1) { echo " checked";
View Replies !
|