Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Using Checkboxes To Delete Record From Database


i would like to use check boxes to delete records from the database. my problem is, the records belong to different tables. how do i indicate in my code "DELETE from blah blah... " from which table to delete from..




View Complete Forum Thread with Replies

Related Forum Messages:
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 !
Mass Delete, Checkboxes
Is there a good code to delete multiple SQL entries with checkboxes? I have a form with a bunch of checkboxes with value="2512", or whatever which goes to the ID column in my SQL table. I want it so that whatever boxes that are checked are selected, so 'SELECT * FROM table WHERE ID="2323" OR ID="1234"'

View Replies !
Mass Delete Checkboxes From List??
The following form/list (sans checkboxes)opens a second forms page (contact_detail.php)
from which to edit an individual contact record.

I'm trying to see a way in which to mass delete (or SET deleted=&#391;') for each record in the list where the mass_delete checkbox is checked.

Simply Check desired boxes and press "Delete All Checked" button, without having to open each contact_detail page. Code:

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 !
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 !
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 !
How Do You Send Data To A Database Via Checkboxes?
I am using PHP to send and retrieve data from a MySQL database via HTML forms. I am using text boxes and everything is fine.

If I have a page with checkboxes on, and the users check them and click on the submit button, how does this show up in the database? Nothing seems to show up for me.

View Replies !
Looping Through Checkboxes To Update A Database
I'm developing an application that is highly database dependent. I've to use checkboxes in a number of places so as to ease the use of the system. However, I'm experiencing problems when it comes to looping through the checkboxes so as to update the related info to the database.

I'm retrieving info from a a database, then the user has to select a number of unpredetermined records. When he does this, a flag for the selected record is set. But I experience problems when it comes to looping through the checkboxes to set the flags for the selected records.....

View Replies !
Create Checkboxes From Database Data
I'm trying to create checkboxes from a database table header row and then pass that to another page.

The checkboxes are gotten from the "header" row of the mysql table.
I check which of these checkboxes are selected and if it is selected, I display the data for the rest of the rows under that same column which is selected as a checkbox. Here's the code to generate the checkboxes:

View Replies !
Form Checkboxes - Inserting Into A Database
I have a survey that i am doing, and one of the questions is pick your top two questions out of six answers. When I submit the form how do I know what check boxes they click and how do I know if they clicked three instead of two?

View Replies !
Insert More Than One Selection (checkboxes) Into The Database
I have a couple of checkboxes and users can select all the apply. I am trying to think what the best way is to insert the data into the database. Should I give each checkbox a different name (vote1, vote2, vote3) and have three columns in the database table for each of them? Code:

View Replies !
Populating Checkboxes From A MySQL Database
what im doing is populating a php variable, and trying to use the result to add either checked or nothing to the value of the checkbox. Any ideas? Code:

View Replies !
Passing Checkboxes Data Into Database
anyone noes how to pass a group of checkboxes data into the database?

View Replies !
Checkboxes And Checking Them Dynamically From A Database
I am producing an edit form. This form will enable a user to edit a product. The product may support many platforms. To enable a user to choose a variety of platforms it was decided that checkboxes would be the best option. Code:

View Replies !
Using Checkboxes To Update Multiple Database Entries
I have a query that shows a list of options that a user can toggle on
or off using a checkbox.

query...
form...
while($row = mysql_fetch_array($result))...
<input name="menu_show_attribute[]" type="checkbox"
class="checkbox"');
if ($row['menu_show_attribute'] == 1) {
echo (' value="'.$row[menu_id].'" checked />
} else {
echo (' value="'.$row[menu_id].'" />');
}

The list is generated from boolean values in a DB. This populates my
form with checkboxes, some are checked and others are not. I'm using
an if statement to sort it (checked). This works fine.

The problem is when the user un-checks a checkbox, the value does not
get passed and the DB does not update - set/change it to 0. The only
values that get passed are the checkboxes that are checked. Below is
the query / code after the submit button has been pressed. Are radio
buttons the answer? Any help / suggestions would be very much
appreciated.

//process form
for ($i = 0; $i < count($menu_show_attribute); $i++) {

if (isset($menu_id) == 'checked') {
$menu_show_attribute = 1;
} elseif ($menu_show_attribute != 'checked') {
$menu_show_attribute = 0;
}

$query = 'UPDATE menu SET menu_show_attribute = "'.
$menu_show_attribute.'" WHERE menu_id = "'.
$menu_show_attribute[$i].'"'
echo("<br>");
echo $query;
$result = mysql_query($query, $db) or die(mysql_error());
}

View Replies !
Selecting Multiple Dynamic Checkboxes From A Database
I have dynamic checkboxes with values populated from a database table and want to set the boxes to selected based on values from another table.

Basically, I have a table of users, a table of categories (populates the checkboxes) and a table that is populated when multiple categories are selected per user (the table used to set the checkboxes to selected)..hope this is clear..Its for an 'Edit user' page, displaying the info for the user. Code:

View Replies !
Values Of Checkboxes That Are Checked To Be Queryed On A MySQL Database
I have a form, a very long form of checkboxes. what I want is the values of these checkboxes that are checked to be queryed on a MySQL database. I'll display some of my form so you get the idea of what it looks like also the url to it so you can check it out fully. Code:

View Replies !
Checkboxes - Loop That Takes The Values And Processes And Writes The Changes To The Database.
I generate a form page from my MySQL database. let's say the table structure is:

Table A
> ID, title, active

the number of rows generated by the query is dynamic. If a field's value is 1, then the form output appears as

<input type=checkbox name=$ID checked> $title

and if not

<input type=checkbox name=$ID> $title

At the bottom of the form there is a submit button. The visitor can check/uncheck rows and then submit the form. I need to write a loop (possibly foreach) that takes the values and processes them and writes the changes to the database.

View Replies !
Getting Last Record From The Database
I have the following table :

----------------------------------
Studnet_id | Reg_no | Std_name | etc....
----------------------------------

- Initially all records are Null.
- Student_id is Primary key.

I want to read last record from the field Student_id i-e NULL and then add +1 to it to get new Student_id. Code:

View Replies !
Display Database Record
i have a php script that read from mysql and display then in textbox.
I have problem with the way textbox display the data.

<input type=text name="package_name" size=20 maxlength=10
value='.$package['package_name'].'>

when the package_name is 'china tour' it will only show china in the
text box. How can i show all the content of the record?

View Replies !
Not Displaying First Record In Database
this code is not showing up first record in database:
the table should start off by clan id = 1 and clan name = name1
page: PHP Code:

View Replies !
Pulling Only 1 Record From A Database
$query = "SELECT widget_type FROM $database WHERE widget_type = 'A'";
$result = mysql_query( $query );
$row = mysql_fetch_array( $result );

if( $row[ 'widget_type' ] == '' ) { $has_widget_type = false; }
else { $has_widget_type = true; }


Lets say I have 300 parts that have widget_type A, will the query find the first one and then just stop or will it continue to search the whole database until it finds all widgets with widget_type A?

If it is searching the whole database, is there a way to make it stop as soon as it finds the first instance of widget_type A?

View Replies !
Database Record Linking
I develop websites on the side, it is basically a hobby. An organization has approached me to develop a site for them which I may or may not take depending on one thing. This organization would like individuals within their organization to be able to access their individual information via a password protected area.

The information will contain their hours worked, hours needed for next level, credits earned,and test scores.The individual should only be able to access their information only. I use MS Front Page, and NetObjects. Is this possible with these programs and if not what is reccomended?

View Replies !
Database Record Update
i have about 10,000 records that contains this link in a record "http://site/directory" now i want to replace it all with "http://site2/directory"..

i cannot do a update set command because the position of the link is not always the same ex.. text text text text <link> text text text.

View Replies !
Writing A Record To The Database
I've been running a dating site written in php/mysql. Most of it was built by someone else and I've done some minor modifications. It works fine 99% of the time, but occassionally it makes small errors when writing a record to the database. For example, it might post a record for a new member and all of the info is correct except it doesn't post the "M" or "F" for male or female. Or it might be a logical field and it posts a "N" instead of a "Y".

Like I said, it posts most of the record correctly with a small exception like the ones above. Also, it might post 99 records correctly, but then one day I get a glitch.

I've only got about 500 members right now, so it's not a big deal. But when I get up to 5,000+ members, these glitches will become a daily occurance!

Do anyone know why this might happen? Is there any way of keeping this from happening? I've only been using PHP and MySQL for a year, so I'm not expert, but I'm assuming this isn't normal.

View Replies !
Select One Record From A Database
I am trying to select one record from a database. This databse has like 10 tables. I do not know which table this record is in. What php and mysql syntax would I use to accomplish this?

View Replies !
Add A Record Into My Mysql Database
I have the following code to add a record into my mysql database: Code:

View Replies !
Select Last Record In The Database
I need to select the last record in a table. What is the query?

table = xyz

The data from this one row needs to be echoed on the page. Rather than have to write out every field, I'd rather have it just take each field's data and echo it on successive rows. How do I make it automatically do this?

Ex:

Fieldname1: Fielddata1
Fieldname2: Fielddata2

and so on.

View Replies !
Displaying Only One Record From Database
For some reason it is only displaying one entry from the database insted of all 13.

$sql = "SELECT * FROM search ORDER BY search_id asc";
$result = mysql_query($sql, $conn) or die(mysql_error());
while ($newArray = mysql_fetch_array($result)) {
$search_id = $newArray['search_id'];
$search_word = $newArray['search_word'];

}


echo "$search_id<br>";

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 !
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);

View Replies !
1 Record In Database But 2 Records Were Selected?
i'm retrieving a record from database. below the record, i have a yes and no button, where i can let user click and then count the number of yes and no.

everything works fine, but when i start to click the yes or no button, my record ,becomes two records. i only have one record in my database, but two same record was displayed.
this is the code: PHP Code:

View Replies !
Insert New Record To Database Without Duplicating
Is there a simple way when inserting a new record to a database to only execute if it is not duplicating an existing record? The way I would currently do this is to query the database first with the new values and see if I get a match, but is there simpler way?

View Replies !
Can't Insert Record Into Access Database
I'm trying to create a registration/login script using Access 2003. I'm using ADOdb to connect through ODBC.

The problem is that I get the little custom error Could Not Connect to Server when I try to insert a record, yet when I use the form with a username I inserted through Access it reads it just fine and returns if the username has been used. Also if I removed line line 23 or die('<b>Could Not Connect to Server</b>'); and it'll complete the script, but it won't insert the record. Code:

View Replies !
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.

View Replies !
Upload Pictures But It Does Not Record It In The Database
im trying to upload pictures but it does not record it in the database that a file has been attached for a particular bulletin.  Dont want to view it, just record that its been attached. Code:

View Replies !
How To Figure Out What Position A Record Is In The Database?
However I would like to be able to figure out what position each user is on the fly. For example, if the user "lisam03" wanted to know what position she is in, I would like to be able to tell her she is #6.

At the moment I cannot do this. I can only tell she is #6 by displaying the results for everyone and finding her position.

Does anyone know any way I can find out, on the fly, what position a record is in a database?

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 !

Copyright © 2005-08 www.BigResource.com, All rights reserved