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 Complete Forum Thread with Replies
Related Forum Messages:
Click Link To Delete Record
I am trying to add a function to one of my scripts. I would like to be able to click a link and have it delete a particular row from by DB. Links are generated by a PHP script and are based on entries on a DB. In this DB I have a column called 'users'. The table is generated by the following snippet: Code:
View Replies !
Delete Blank Line
My code add contents of form into text file. But it also add empty line into end. How can I delete that last empty line? My script look like this: $new_array[] = "$contents"; } else { $new_array[] = $line; } } $data = implode('', $new_array); $fp = fopen( $filename , "a" ); flock( $fp, LOCK_EX ); $data=trim($data, "."); fwrite( $fp, $data ); flock( $fp, LOCK_UN ); fclose( $fp ); ?> I try to use trim but then script writes contents of file into same line.
View Replies !
Delete Record
i have this code for my site that will connect to my database and grab all my members there id email and ip the problem is that it dont have a button where you can select a member and delete that member can anyone help me with this?i want to add a button and a check box so if i check off a member and click a delete button it will delete that member here is the code:
View Replies !
Delete Record!
I am using PHP5 , MySQL5, Apache 2 My Database was created with phpmyAdmin.Then I inserted with script and phpmyAdmin data into the Database. Now I am Unable to empty or delete or remove any fields out of the Database. Neither a script ot phpmyAdmin can delete.What has blocked the database? I have restarted my pc, Still I am unable to remove anything.
View Replies !
Delete Record And Files
I have a code that uploads images along with some info into a directory and database, this all works fine. I can delete the record but the images relevent to that record continue to exsist in my images directory. How would i set up a php code to delete a file in ../images when the record of its name is stored in a column in my database. Here is my delete record code:
View Replies !
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
View Replies !
Unable To Delete A Record Using Php
I am having a form which displays a couple of values from database and a delete button which is used to delete that particular record. Below is the code that I am using, but I am unable to delete the record. Please help me to get the record deleted. Code:
View Replies !
Confirmation When Delete A Record
I want to add a confirmation before I delete a record. For example if the user wants to delete they press "Yes" otherwise "NO" and go back. <?php //delete user $sSQL = "DELETE FROM user WHERE (`userid` = ".$_GET['record_id'].")"; $result = mysql_query($sSQL) or die(mysql_error()); echo "<h1> User deleted succesfully</h1><br>"; ?>
View Replies !
Delete Record - You Have An Error In Your SQL Syntax;
Im some having trouble with deleting a record, surely it isnt that hard, dont know what im doing wrong. this is the error i am gettin: 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 '` WHERE id=1' at line 1Here is my delete code:
View Replies !
Delete Record If Older Than 5 Minutes?
Can someone help me in writing a query command, to delete a record, if the last_update field on a record is older than 5 minutes? My table has a last_update field, which holds a value as this for example: 2007-04-08 01:33:12 I need a query that when I access a php file, if a record is older than 5 minutes, it will delete it.
View Replies !
Dreamweaver Generated Code To Delete Record
I use the dreamweaver generated code to delete a record, how would i add some code to it to delete the files (images) stored in my../images folder, that are linked to the record being deleted, there field names are photo1, photo2, ect..... and there image names are stored in the database Code:
View Replies !
Auto Delete Record/Send Email After X Hours
What I have is a MySQL database which stores records that each have a date stamp on them (2 of them - one for record created date and one for record last updated date), what I want to do is try and have it so that records that haven't been updated in say 72 hours are automatically removed from the database, or the record is updated to set a flag as being out of date, or an email is sent to alert a user of the out of date record etc. I can easily write the script with the SQL query to check the records by the datestamp and perform the actions needed if the records are out of date, however that requires someone to physically visit that page to run the script and clean up the out dated records. What I want to try and do is have this happen automatically on its own without someone needing to actually visit the page to run the script. A good example is on eBay how emails are sent to you to let you know when your auctions are about to expire, i wouldnt imagine that eBay would rely on people visiting their website to make those queries run on the database so there must be a way of doing some automated script executio or having a scheduled task run on the server to have a PHP script run each day at midnight or something? Anyone know how to do this?
View Replies !
Delete Link Using Product Id
I'm building a site where the I can add and edit the products that are in mysql. I am trying to add a dynamic product id for each "delete" link. So instead of having a hard code of: Code:
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 !
Create A Link To Delete An Image?
I'm making a really simple cms, but having problem deleting images. I've managed to create a page to upload the images to a folder. I also have a page that shows all the images and file names. Now I'm trying to add a link to delete images, but I can't get it to work. First of all I don't know what to put in the href tag...? Someone said I should create a new page that deletes the image and then redirects you back to the page displaying the images...? Code:
View Replies !
Delete An Image From Web Page
i have a script (below) which lists all the images in my images folder on my website - I was wondering if somebody could give me some idea of how to add a delete link to the following script so that i can easily delete each image. Code:
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 !
MySQL DELETE: How To Get Page To Refresh?
I have a script that deletes records in a table. It works fine. However, it redirects the browser back to the page and the record stills shows there. Only after the page is manually refreshed does it disappear. I've used both header("Refresh...") and header("Location...") to accomplish the redriect, but no dice. The only thing that seems to work is if a unique URL is pushed into the address bar, which I do by appending md5(microtime()) to the end of the redirect URL.
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 !
Making A Page Expire/delete Itself From The Server?
I'm a freelance web designer and I was wondering if I could put page on a clients server, and the page (or certain parts of the page) would automatically be deleted unless I did something?? (like maybe a php function or something). The reason I'm asking is because sometimes peeople I do work for leave me high and dry, don't pay me and just change their password to their server.
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 !
Deleted Record Still Being Counted.
Can anyone see any reason why this query would not return the number of rows containing the correct "EID" "CID" where email address is "cs.com" or "webtv.com"..... for some reason it always returns 1 even if the database is empty. The only other flaw that I see is that I had a record that matched this criteria, then I deleted it from the database, but it still seems to want to count it for some reason. PHP Code:
View Replies !
Identifying The Clicked Record
i already know how to load the my list of suppliers using mysql/php/apache, but what i would like to do now is put a link for each and every supplier and when someone clicks it, they will automatically go to that supplier's list of products. i want something like this: SUPPLIERS TABLE supplierID, Name, Address, AA Alfin21 1506 w. 66th street <>EDIT<>
View Replies !
Show The $message Text If In Fact A Record Was Deleted.
After a user confirms deletions of a db record they are re-directed to the main page again. That page should delete the record they confirmed previously and also show the $message text if in fact a record was deleted. Since a user can also come to this second page before deleting a record, the if statement shouldn't run in this case, or if does the $message variable should default to an empty string and display that. Here's the If statement I'm running: if ('$_POST[ID]') { $sql = "DELETE FROM $table_name WHERE ID = '$_POST[ID]'"; $message = "<p><font color="red" size="2">-- record deleted --</font></p>"; } else { $message = ""; } ........
View Replies !
Logging A Clicked Link
Currently, I use a 3rd party shopping cart that is disconnected from my website. In other words, when a person clicks on the "Buy Now" button, it leaves my website and goes to the 3rd party shopping cart site to complete the checkout process. I want to log the instances when a user clicks on a "Buy Now" button. How can I do this? My first inclination would be to use a javascript solution such as: <a onClick="return linkClicked()" href="http://www.example.com/cart.asp?product=widget"> BUY NOW!</a> linkClicked would open a file on my server and add an entry. I've found that this won't work since javascript won't let me write to files. Is there a way to do this in PHP? Is there a way to log the clicked link and then immediatly forward the user to the shopping cart?
View Replies !
Clicked Link Text
I have created a table on the fly from mysql while($row = mysql_fetch_array($query)) { echo "<tr>"; echo "<td class='body'><a href='#'>".$row['au_id']."</a></td>"; echo "<td class='body'>".$row['au_fname']."</td>"; echo"<td class='body'>".$row['au_lname']."</td>"; echo "</tr>"; } is there anyway of getting the current clicked au_id? i would like the user to click the id to display more information but I'm unsure how to get the currently clicked id...
View Replies !
Testing If A Link Has Been Clicked...
I have this bios link on a dynamic php menu...there are two bios under bios...what i want is to test and see if the bios button has been clicked...if so, i want two sub-menu links to appear below the bios link...I understand I'll need to do an if...else here but how do I test to see if that bios link has been clicked?
View Replies !
Update A Counter When A Link Is Clicked
I have seen some tutorials to put a update a counter field in a record. I have the counter field in a table that also has a field for a path to file. I display the records in a table on a web page e.g. IndexNo ............Title................................ Link .................................... Count ......1.............MyFileName........www.mysite/files/MyFileName.doc........ ......0 etc User can click on the Link field in the table to download the file. The problem is I can't find a way that will run an update query along the lines of $Query = mysql_query("UPDATE Resources SET Count = Count + 1 WHERE IndexNo = '$IndexNo'); when the user clicks the link Can anyone suggest a way or direct me to a tutorial
View Replies !
Determining First Time Link Is Clicked
I am currently working on a site using php and mySql with a restricted user area. The admin of the site has the ability to update messages and upload pdf files for their users. When user A logs in the messages specific to user A are retrieved from the database. Also I use a script to check the user specific folder for files and these are then shown as links allowing them to view the pdf files. Now I am looking for a way to determine when a link to a pdf file is followed the first time only, so an email can be send.
View Replies !
Admin Redirect To Link Clicked
I must begin by saying you guys are the greatest and most patient helper of newbies on the net and I am sure I speak for all of us when I say thank you. I have a member login script that is my first script, and was written following an article extremely closely. All is working well and with no error but there is one minor issue. Code:
View Replies !
Click Counter :: How Many Times Link Clicked
Anyone know about a script/code that count how many times a link have been clicked.. I have tried hotscripts.com, phpbank.net and so on.. Only found scripts that costs money or uses a MySQL database. I need one with no needs for MySQL. It should look like something like this: [ Download ] Been downloaded (NUMBER) times.Anyone know about a simple script to do that?
View Replies !
Pull A Random Profile When A Certain Link Is Clicked
I would like to pull a random profile when a certain link is clicked in a script that I am working on. I haven't used rand() ever so I don't really know how to use it. I tried using something like this: mysql_query("SELECT * FROM tblusers WHERE id=rand()") This syntax doesn't work and doesn't seem right anyway.
View Replies !
PHP-generated Link To Local File Doesn't Work When Clicked On. Why?
I'm running an Apache server on my own computer (Windows XP Pro). I wrote a simple PHP script (called test3.php) that I'm running by putting the following URL in the address bar of the browser (Firefox) .... http://localhost/test3.php The script generates the following link using the echo statement ... <a href="file:///C:/pictures/xyz.jpg"> Picture </a> ("C:/pictures/xyz.jpg", as you can guess by now, is an image file on my harddrive, but it's not in the document root). When I clicked on the link, nothing happened. However, if I RIGHT-click on it and select "Copy link location" (which copies the URL to the clipboard) and then paste the URL into the address bar of the browser, the picture then displays correctly. Why did it not work when I clicked on the link the first time, but it only worked when I pasted the link to the address bar? Is there some special notation/syntax that I need to use to get this to work properly?
View Replies !
Check Whether The User Has Clicked On A Link - Undefined Index Error
if (!$_REQUEST['view']) { I placed that code in one of my files to check whether the user has clicked on a link that is supposed to direct it to view a blog item. If it is indeed untrue, then it shows a list of blog items, else it shows the blog with the id set by 'view' For some reason, the code works. But it gives me this undefined index error nonetheless.
View Replies !
Multiple Blank Record Entries?
I keep getting multiple blank records entered along with my data everytime I submit my form. On the first page is the form itself without any code. On the 2nd page that it goes to after I hit submit is this: Code:
View Replies !
MySQL INSERT Command Adding A Blank Record
I have a form that I am INSERTing into the MySQL database. I have the names and vaules set. The columns header is the same but when I "submit" the form it adds a blank record to the database. If I add another one, another blank record is added. 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 !
|