Deleting A MYSQL Record From Within An Html Form
Just rebuilt an admin tool in PHP (originally built in asp) for a news section of a site.
The problem is: My delete records php page is set out in an html form, with each news story expressed with a checkbox. normally i'd put a <a href="delete.php?id=<? echo $row->id; ?> </a> alongside the record, but i need to have it work in a form.
What action should the form have, and how do i get the form to process the deletion process with the correct news story checkbox selected?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Deleting Record From Mysql
I am just tring to delete on record based on a link generated. The link shows up, the number of the field is shown as deleted when the link is clicked, but the entry ios still in the db. Maybe a problem with how I have the db setup? I only have one field, add_manufacturers, and it is text. It is in a table called manufacturers. Code:
Inserting Record From Html Form
i am trying to insert a record into a mysql database with php3 I can't seem to insert data into a decimal 10,3 field..no matter what I enter, 0.00 shows up in the database. almost like it's trying to insert it as text, instead of a value... any ideas?
Deleting A Record.
One last (hopefullly) problem I can't seem to get around for this program...why isn't this deleting the row i want? It does nothing. Now error messages either. HELP! $link = mysql_connect("localhost"); if(! $link) die("Could not connect to MySQL"); $database = "PC_Store"; mysql_select_db($database) or die ("could not open $database: ".mysql_error() ); $result = mysql_query("DELETE FROM inventorydata VALUES('$ProductID')"); The $ProductID variable is brought in from a menu choice on a diffrent page, it is also the primary of the table...so it should delete the whole row right?
Safely Deleting A Db Record With Php
I hope I'm not OT. I have the following issue: I want to delete a record from my db with a php script. Let's say I'm auth'd and I want to delete the record id 440. With a simple form (get or post), I send the id to my script and delete the record (DELETE FROM table WHERE id=some_validated_input). The problem is if I'm a nasty guy I just write my own form and delete any record I want (since I'm auth'd) by just sending another id. Is there any way to make arbitrary record deletion non-trivial in php? I'm thinking about a hash function to replace the real db id (DELETE FROM table WHERE record_hash=validated_form_hash), if possible without adding an awfull lot of server side computation.
Deleting A Record From Another Table
I would like my code to delete the relevant confirm_code from the temp_users table but I'm getting the error Your account has been activatedYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE confirm_code = '5f6feb0f5d104c2a6b7ce24d40711f74'' at line 1 My code:
Checking If A Value Is Not In An Array And Deleting Record From Database
I have been trying to figure this one out and have come up against a brick wall although I know it should be relatively simple. I have a form that passes an array to a php script from a multiple select box that is created dynamically. If a user deselects an item then I want to delete the record from the database but am having a big problem with it. The table in the dbase is quite simple with just three fields: id classid formid Basically, the form send through a classid and a formid value and I want to delete any records that have a classid that are not in the form array and have a formid which is passed as a hidden value. I suppose really what I want is to know how to see if a classid is not in the array that is passed.
HTML Form With PHP And MySQL
I'm building a content management system using PHP and MySQL so that we can add and remove projects from our website easily. I want several dropdown lists with the options Yes/No (or radio buttons, whichever is easiest) in them and depending on the users choice it will add their choice into the db. I have the Add page working fine, but the problem lies in the update page. if i go to my update page it pulls all the right information back into the HTML form from the DB until it gets to the dropdowns, which it doesnt like. How can i make it select the appropriate option from the dropdowns depending on the DB? If i submit the changes it wont update it either and gives errors from the dropdown code. Code:
How To Populate HTML Form From PHP/MySQL
I have found many examples of how to access an HTML text field from PHP, but cannot find the reverse - how to load an HTML form from a MySQL database. Specifically, I have an HTML form which contains several text boxes that correspond to the fields in a MySQL file. What I want to do is call a PHP form that reads one record from MySQL and then populates all of the HTML fields on the calling form. The call to MySQL is not a problem - that works and I can use "Echo" to verify that I have successfully read a record. Now, how do I get that data back into the original HTML form?
Html Form Controlling Mysql Query
im trying to have the user choose an album from an html drop-down menu, submit the choice to a php page which runs the mysql query based on the choice. the code:
PHP:Unable To Post Variables From Html Form To Mysql Database
Plz dont treat this as another newbie query , i did my homework but still getting nowhere :( :( :( Trying to learn PHP on Fedora core 1 (PHP 4.3,MySQL,HTTPD).Unable to post data from html form to php file(connecting to mysql database and inserting into a table) . This seemingly simple problem is making me go mad !!! I googled extensively and already tried the following I enabled " register_globals = On " .... in /etc/php.ini and also took used _$POST syntax. wot could be the problem .... is it the case that /etc/php.ini file is not being read .... how do i know whether this is the default location for php.ini? Where can i find the PHPRC environment variable (the variable responsible for the php.ini default location) Is the problem something else .....? Following is the code ... form.html --------- <HTML> <HEAD> <TITLE> email entry form </TITLE> </HEAD> <BODY> <P>plz fil the form </P> <FORM METHOD="POST" ACTON="form-handler.php"> NAME: <BR> <INPUT TYPE=TEXT NAME="givename" SIZE=25> <BR> AGE: <br> <INPUT TYPE=TEXT NAME="givenaddress" SIZE=25> <BR> <INPUT TYPE=SUBMIT> </FORM> </BODY> </HTML> form-handler.php ----------------- <HTML> <HEAD> <TITLE> EMAIL FORM HANDLER </TITLE> </HEAD> <BODY> <? mysql_connect("localhost","root") or die("Failure on db connection"); mysql_select_db("mydb");
Deleting A Line Of Text From A Txt File From A Form
How can i delete a line of text from a .txt file using a form? because i have a form right now that saves information from a form to a txt file for news, now i need to know how to make it so i can delete it from a form. also, if you know how, how do you overwrite lines of text in txt files from a form?
New Record Inserting On Refresh The Form
I have one form for collecting feedback from users. On submitting the form, it inserts a record in to the database. I am using Postgresql as database. This is working fine for me. but, if I refresh the form after inserting a record, again it is inserting a new record with the same POST data. For each refresh, a new record is going into the database. How to overcome this problem. any idea?
Mulitple Record Form Edit
I'm working on a form to be able to edit multiple records at the same time but only the first record is showing the correct details. Code:
Multiple Record Form To Database
I have a form that has header information on the top such as dates, city, state, event, etc. The detail information of the form has several rows, 32 to be exact. Each row has 4 fields (name, gender and association). I named them 1name, 1 gender, 1 association for row 1. 2name, 2gender, 2association for row 2, etc etc etc. I need each row to be a separate record within the sql database but also carry in the header fields.
Deleting Rows In Mysql
Is there a way in php that I can mark a row in my mysql database and then later so delete these rows that have been marked?
Deleting Entries From Mysql
I have business listings that I have pulled from a database(MySQL) and printed to the page, in an admin page, for review. I'm trying to write a script to add and one to delete the listing. I get an SQL error, 'check the manual for blah blah near " on line 1' Here is the 'delete script:
Deleting From Mysql Table
i'm trying to replace a record in a mysql table but i'm having problems. First i've got a page to store existing film name values using: <input type="hidden" name="Name" value= "<?printf($row["Name"])?>"> The second page is supposed to delete the existing record by comparing the stored name value with the database name but it only creates a a duplicate record. Here is the code for this: Code:
Deleting One Row From Mysql Table
I want to delete one row of a mysql table, and still to be in the same page, but the page needs to be reloaded and to give me new results Code:
Deleting Mysql Rows
Is there an easy or another way to delete rows? Right now I'm checkmarking the row I want to delete and then clicking on the red x for each one. It takes absolutely forever. Is there a better way?
Remove Record Id From Static Name In Form Action Script
I am creating a page that has multiple dynamic forms, two of my form elements are using a static name and the record id (this is needed for another reason.) I need to remove the record id, so my post in my update script will be: $date_start=$_POST['start']; $date_finish=$_POST['finish']; <input type="text" name="start<?php echo $task_number; ?>" value="<? echo $date_start; ?>"> and <input type="text" name="finish<?php echo $task_number; ?>" value="<? echo date_finish; ?>"> In the update script I can access the input value by using the variable ${'start'.$task_number} Is there a way to remove $task_number from it so it posts as 'start' and 'finish'? Do I somehow need to provide the form action script a list of task_numbers via an array serialized and urlencoded via a hidden field to decode and unserialize? If so, does anyone know how? If not, does anyone know how I can do this?
Deleting A Table From A MySQL Database
I've looked at the manual and a few other php resources, but yet I couldn't find a simple and easy way to delete a table using php. I noticed there is a destroy() function within the MySQL class, but I'm not sure how it's used.
Mysql And Php5 Deleting Rows
I can't seem to delete rows from a mysql database. I have a database that I want to delete rows from based on user name. i have researched this extensively and can't seem to find anything that works.
Getting One Record From MySQL
I am very new to php-mysql, and im a bit confused by all the tutorials which explain how to get records from mysql. In all the tutorials, they show how to recover all records from a table using a loop command. I have a mySQL table called news, which has headline and a body fields (as well as id). On my php page, i have two seperate tables. One I wish to print the info from one of the headline fields , and the info from the field body in the other. I don't wish to print all the records.
Best Way To Update A Mysql Record
I have a small app that a user can select an entry to be considered as "cancelled". This will change an entry in a mysql database. Is there someway of making a button that as soon as its clicked, sends the appropriate update info to the database and reloads the page?
Please Help With A Record Problem With MySql
I have php code that enters information into a mysql database. How can I make it so that the person entering the information has the choice for the listing to expire after a given number of days. Therefore I would like the record to become not active after this period.
Accesing A Record In MySQL And PHP
I am accesing a record in a MySQL DB with the a sentence embeded in a php code. The result access a page like: http://www.mysite.com/page.php?id=16 where the id=16 indicates the id of the result. This work perfect, but I donŽt want the user to know that the number 16 correspond to a specified record. IŽd like to change the 16 for an algoritm. The algoritm result will be 16, but this will be only know by the database. As example, IŽd like that http://www.mysite.com/page.php?id=ewrefj34239dsa equals http://www.mysite.com/page.php?id=16
Record Expire PHP / MySQL
I created a database that lets people post a job opening. I thought of manually removing each entry after 2 months, but is there some code that can do this without me having to monitor the table?
Edit Mysql Record
I want to use a userform on a webpage so members can edit their data. Displaying the data on the form isn't the problem. But when members change their data how do i save then new data in their record. I dont want a new record.
Mysql Delete Record
when I run this code below it doesn't delete the record or display any error message $id = $_GET['id']; include("../dbconnect.php"); mysql_query("DELETE FROM promotions WHERE id='$id'") or die(mysql_error()); Such a simple thing to do but I don't no why it doesn't work
Not Updating Record Into MySQL
I am attemting to update a MySQL record and after I hit the submit button from the update form I get a blank white page. I have error reporting on, but still nothing. Code:
Batch File Deleting And Folder Deleting
I have a folder in my web site where I used php to create and copy in files. but now I can't delete them easily. The only way I know how that is possible is through php. I get an error the following ftp error: 550 th: Permission denied I had the chmod() set to 0777 on every file and folder. But I still seem to loss control over the files when I try and do things with them through other means. I think it is because the user I use to access the files via ftp a diffrent user. So I tryed to add a function with chown() for the new files I was posting and uploading. It didn't work on those new files. so it looks like the only thing I can do is use the unlink() function which deletes the files fine. The only problem is now I have something like 100 sub directories all with files in them. I need to figure out a way to batch delete them. I can't find a script that goes through and finds all file contents including all sub directories and unlink those things. I found some that will use a for loop to list out the contents of a folder but it is just files. No sub directories. Any body got any ideas on which functions I should use or know where a script is that I can base mine off of. I am not sure how to approach this since what I tryed with chown and chmod has failed thus far. I currently have no code and am starting from scratch on this batch flushing of my directory.
Deleting Duplicate Entries From MySQL Database Table
The topic is related to MySQL database. Suppose a table "address" contains the following records ------------------------------------------------------- | name | address | phone | ------------------------------------------------------- | mr x | 8th lane | 124364 | | mr x | 6th lane | 435783 | | mrs x | 6th lane | 435783 | | mr x | 8th lane | 124364 | ------------------------------------------------------- Quote:
Updating A Record In A Mysql Database
I am sorry if this is a simple oversight, but I have been struggling for many hours over something which seems dead simple. I need to update a record in a table with more info. I am using the code below which soen't give me any errors but nothing happens. include("link.inc"); $db=connect_db(); $db_name=db_name(); mysql_select_db($db_name,$db); $sql="UPDATE data SET age='age',live='live',whatdo='whatdo',drinkalcohol='drinkalcohol',takedrugs='takedrugs',firstdrug='f irstdrug',seconddrug='seconddrug',medicine='medicine',alcohol='alcohol' WHERE id='$id'"; $result=mysql_query($sql,$db);
PHP-MySQL: Returning ID When New Record Is Made?
Let's say I create a new record in a table like this: mysql_query("INSERT INTO table (col1) VALUES ('example')",$conn); ....that had an auto-incrementing, unique identifying column named "ID" that would be populated with a unique number upon insertion... How can I get the unique number it assigned to that record returned for futher use?
Output Xml File From Mysql Record
how to get the record from databse directly..but now my application require me to output my record as xml output....so I really need help on it.../some guide ...this is what's my xml gonna be.. Code:
Applying A Class To The First And Last MySQL Record
I need to apply a class to the first and last records from a MySQL query. What I'm trying to do is pull the menus for my site but the first and last links need a class name for the design. I can't set them in the database because the order and items in the menu will change from time to time. so, here is how I pull my menu (cut down for this post). You can see it just grabs the name, url and makes a link. How would I apply a class to the first and last records? mysql_connect("localhost","root","password"); mysql_select_db("my_site"); $result = mysql_query("SELECT * FROM menu ORDER BY id"); while ($are=mysql_fetch_array($result)) { $name = $are['name']; $url = $are['url']; print '<a href="'.$url.'">'.$name.'</a>'." "; }
Return Record Ranking Of A Mysql Table
I have a table consisting of names, and registration dates. I query the db "select * from users order by regdate" I want do another query for a particular user, I am looking for the script to say: user is row 15 of 30.
Compare Record With Session Variable And Update Record If Different
I'm trying to figure out how to create a session variable from a recordset field value in a mySQL database and compare this with subsequent values from the same field each time the page reloads. When the value of the field changes (as a result of a user update) I want to trigger an event (redirecting to another page). It's probably a very basic PHP function but I am a newbie with this language.
Assign Mysql Record Values To Gloabl Variabel
I've been struggle with the code below. I've tried mysql_fetch_assoc and various other functions, but can't seem to get it to work. The code works as far as that point though. global $first_name; global $last_name; global $password; function get_acct_rec($email){ $conn = db_connect(HOST, USER, PASS, DB, PORT); $sql = "SELECT * FROM `clients` WHERE `email` = '" . $email . "'"; $c_result = mysql_query($sql, $conn) or die("Failed to execute query at line " . __LINE__ . ": " . db_error($conn)); while ($row = mysql_fetch_assoc($c_result)) { $first_name = $row['first_name']; $last_name = $row['last_name']; $password = $row['password']; echo $row['first_name']; } mysql_free_result($result); db_close($conn); }
Image Upload, Resize, Rename And Create Record In Mysql
I have limited knowledge in php and I am having trouble with uploading an image to a remote directory and resizing it if it's larger and renaming it to a unique id, while at the same time I would like to create a record in mysql database. I've tried to find some tutorials but I've had trouble finding any good ones. Wondering if anybody has good examples or link to a good tutorial.
How To Make A "sophisticated" Insert Record Form ?
I have a DB with many inter-related tables (MySQL) My main table called "content" has almost only foreign keys (integers) some have a 3 level relation (ex: content->city->region->country) I would like admins to be able to insert new records including all the "content" fields (in 1 page form) But how can I make an insert form that would display the related tables as list menus instead of a textfield with a number? (ex: select country from a drop down menu instead of typing the foerign key number) Main content Table: IDRef = primary key IDLocation = foreign key --related to tables city->region->country IDDescription = foreign key --related to table Description (=several big and small text fields) IDImages = foreign key --related to image (=image and thumbs path, alt text, etc..) Do you know any tutorial, help or solution ?
|