deleting data from database using checkbox

hi ,

i have to delete data from database using checkbox.but there is one problem when i check any checkbox all checkboxes are automatically checked.but following codes are not execute.please help me.
PHP Code: if($c[$j]==on)

here is my full code
PHP Code:

Posted On: Thursday 25th of October 2012 11:15:42 PM Total Views:  161
View Complete with Replies

Related Messages:

Primary keys, indexes and auto deleting rows from multiple tables   (258 Views)
I have about 4 tables in my MySql InnoDB database (members, stories, characters, comments). In my site people can post stories, add characters to each story, and make comments on each story. The tables are set up with the following columns: Members - member_id (primary key), email (index) Stories - story_id (primary key), member_id (index), the_story Characters - character_id (primary key), story_id (index), falsehood (index), story_character_name Animals - animal_id (primary key), story_id (index) Comments - comment_id (primary key), member_id So the problem I am having is when a member deletes a Story. I want the characters to also be deleted from the Characters table, and the pertaining comments to be deleted from the Comments table etc. So far this is only working on the Animals table. I think I know why it is not working on the Comments table - because I do not have story_id as an index, right As for the Characters table, the column called falsehood (index) is no longer a column of the table (because I removed it, as it was something I was testing), however it remained under the structure, as an index. I left it there because I did not want it to mess anything up. Is that what is causing my problem on this table Is it safe to delete it The next big question is... once I get this working properly, will I have to go in and manually delete from Characters, Comments, the rows that no longer have a pertaining story_id
How to reset ID when deleting row?   (111 Views)
I have a table where the user can add events. The ID field is set to auto-increment, so every time an event is added, the ID increments. BUT when I delete a row ("DELETE FROM events where ID=$id"), the row does get deleted, but the ID does not get reset. I guess what I am trying to do, is have the ID reset. Say, if I have 10 events, and delete 8 of them, I have 2 left. When I add one more, you would think it's ID would be 3, but is is actually 11. Is there a way to do this Thank you.
[SQLite] Need help with deleting duplicate rows...   (176 Views)
The rows are not quite duplicates... I have a table with a field id1 and id2. There are times when there are 2 rows with id2. In that case they will have different values for id1. I want to delete the 'duplicate' row where id1 is a certain value. So in words, I need to "delete from table where id2 = someval and id1 = 1 but only if there is another row where id2 = someval and id1 = 14" So something like this: index id1 id2 --------------- 1 1 223 2 1 226 3 14 226 4 1 300 5 1 311 6 14 311 7 14 345 The result then needs to be index id1 id2 --------------- 1 1 223 3 14 226 4 1 300 6 14 311 7 14 345 Any ideas on how to do this with single query It is an sqlite db by the way...
How to reset ID when deleting row?   (149 Views)
I have a table where the user can add events. The ID field is set to auto-increment, so every time an event is added, the ID increments. BUT when I delete a row ("DELETE FROM events where ID=$id"), the row does get deleted, but the ID does not get reset. I guess what I am trying to do, is have the ID reset. Say, if I have 10 events, and delete 8 of them, I have 2 left. When I add one more, you would think it's ID would be 3, but is is actually 11. Is there a way to do this Thank you.
MYISAM table currupt when deleting records   (234 Views)
I have MySQL 5.02 on RHAT with 3 tables that has lot of data. These have records in the millions range. I have a delete script to remove data older than X date but every time I have run this, it corrupts the tables. I started using a SP for the deletion but it still corrupts the table. One additional thing I do is also backup the data being deleted into .sql file. Delete script works fine on smaller tables. Does anyone know if this is a bug in MySQL or if there way better way to delete old data on large tables
Using magic numbers or storing redundant data?   (210 Views)
Say I have a couple of columns in a database table, named BizType and AccountType. To satisfy business rules, BizType needs to be either a "Parent" business or a "Sub" business. Second, AccountType needs to be either "Business", "Personal" or "Both". BizType My first inclination was to make 1 represent "Parent" and 2 represent "Sub", and then store a series of 1s and 2s in the data column. However, after I looked how the database table looked using these "magic numbers", I was afraid it would cause another developer a bit of a headache in trying to determine what these numbers represented, even though I did put the representation in the table comments. So I changed all the 1s to Parent and the 2s to Sub and put a constraint on the table so that BizType must equal Parent or Sub. However, I still wasn't happy with how the table worked, mainly as a result of storing redundant data. I'm having trouble though justifying creating a second table that stored Parent and Sub with IDs of 1 and 2 and storing those IDs as foreign keys in my original table as these aren't likely to ever change. Also, although another developer is more likely to realize these are foreign keys and find the related table, I dont see this situation as significantly more beneficial than using magic numbers, as these values are unlikely to change. Account Type I had the same problem with this column. I was going to assign 1 to Business, 2 to Personal and 3 to Both. I didn't like using magic numbers so I decided to just stored Business, Personal and Both. But now I don't like storing redundant data, but cannot justify creating a second table to store the three values, as they are not likely to change because of business rules. Also, the future developers might still look at the table and say "What do these numbers stand for" I don't see creating a second table storing the three values as being much more beneficial than using magic numbers. If anyone has ever come across a similar situation and could give me some direction/advice on what might be an appropriate way of solving this problem that would be spectacular. I know the cardinal rule of databases is to not store redundant data, but I wonder if this might be one of those exceptions, as magic numbers are frowned upon as well, although more so in programming. Thank you all for you time! Travis Rhynard
Need Help(database backup)   (158 Views)
, May I ask on how will you back up a database via cron jobs in an hourly basis
Separate database???   (150 Views)
I have a site on which i am using two tables> one for say articles and another for stories. There is no link between the two tables AT ALL and they are independent of each other. Also the tuples (rows) in both story and articles table varies. Now my question is should i keep both stories and articles in the same database or should i make separate db for each of them. eg db_stories and db_articles having stories and articles respectively Does it make any difference if i use different db for each Also once the above thing is finalized I would like to have a common search; which will extract data from the articles and stories both stored in the db for a input by user. Is it possible If yes please explain/elaborate and give some examples to how to implement a common search Please give your comments/suggestions keeping the site security, easiness to work in mind andn any other parameter which is important
Having trouble importing databases. vbulletin   (188 Views)
The sql file is too big for phpmyadmin, and they suggest ssh, but im not so good with it, and i have tried every combination of command I have found when researching on google. I then came across a script called "bigdump". I have all tyhe settings correct in the bigdump.php but I keep getting this error: Database connection failed due to Access denied for user 'USERNAME'@'cgihost' (using password: YES) they ask to change these settings which i have the correct DB username and pass. The server isnt "localhost" with my new hosting company. (netfirms) $db_server = 'MYSQLHOST'; $db_name = 'NAME'; $db_username = 'NAME'; $db_password = 'XXXXX'; I have tried changing permissions and following all directions from bigdump. could someone please help me
which database to implement for my site ?   (155 Views)
hello I'm in the proces of creating a new website that in potention could become huge and could attrack many tousands of visitors who will register themself. The database will become very simple, only fields: Name, Email address, Password, country and some similar fields containing numbers only which all should be inserted through the website. I like to hear opinions about which database i should use for this website because my knowledge about databases is very slim. 1. Access -> I have experience with using Access with websites so i could build this myself but i heared this database type is more suitable for smaller number of records etc. Also i have experience that Access regular give errors because multiple users are accessing the Access database at the same time And how about speed with an access DB has for example 500.000 records 2. SQL -> What i understand more suitable for larger databases, no problems with users accessing the database at the same time Problem with implementing SQL is that i have no knowledge how to build this If SQL is the most suitable option i will consider to hire someone to build it for me. How is the speed with SQL databse when reaching lots of records 3. Other databases Hope to hear some suggestion from you ! Kind regards Database Newbie
Best table layout for this type of data?   (85 Views)
OK, I have a database of products, say computer hardware. The products table has all products because most products have the same stuff, price, name, model, etc...but some products have "extra" stuff. Say, if it were computer products a hard drive might have a speed or size associated with it but a monitor would not. Would it be best to add say like 5 columns(spec1,spec2,spec3) and they just contain the data if it exists or is there another way like create a hardrive table with (speed, size) columns and link the product table to that table
right design for database   (85 Views)
hi i attached my database in jpg picture if any body please can look at it and till me if it is normalized properly this is my first database i ever done, the data base is going to be used for a web site that will allow you to list your home for sale ,how ever the listing will be for free, donation will be accepted that's why there is product table your comment will be appreciated please not that the attached database will be implemented in mysql , i would like to say
Add a user to a database   (92 Views)
, I would like to add a user to a database. A very simple thing you would think, but I can't get it to work. This is what I have: GRANT ALL ON database_name.* TO 'user'@'localhost' IDENTIFIED BY 'my password'; flush Privileges; But for some reason this doesn't work. The user already exists, so could that be the reason I just want to give it permissions to this new database i've created now.
Merge Two MySql databases   (183 Views)
, I have two databases on my website with the same tables. One with a 1665 members and the other with 33 members, I want to merge them together. is there a way other than typing each records by myself or ask the members to register again Thank you
what data base tabels need in E-shopping site?   (105 Views)
hiiiiiiiiii what data base tabels need in E-shopping site we design E-shooping web site >> we need help in this project.... it the first time and i do not know what can i do put i know will in oho and i will design my site in php i want to know what tabels in data base we need and any thing can help me in this case please replay to me moussa
how to set a password on a databse   (90 Views)
I bought a php dating script and am trying to set it up to run on my server at my home. I have installed amp and it is working fine. I created a dadabase in mysql but I forgot how to assighn it a password. Can someone please help with this
synchronizing MS SQL databases   (315 Views)
Hi , i have a live MS SQL server with a database in it which stores the required information, i have a another server with same database structure and content. Is there in way can make both the databases to synchronize. Live time will be great and time based will be ok. help appreciated. Thanx
How to cascade delete related records without deleting the main record?   (262 Views)
Let's say I have the following database tables: Code: CREATE TABLE user ( id INT UNSIGNED NOT NULL PRIMARY KEY, username VARCHAR(20) NOT NULL, ) ENGINE = INNODB; CREATE TABLE user_email ( user_id INT UNSIGNED NOT NULL PRIMARY KEY, email VARCHAR(100) NOT NULL, FOREIGN KEY (user_id) REFERENCES user(id) ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE = INNODB; CREATE TABLE user_phone ( user_id INT UNSIGNED NOT NULL PRIMARY KEY, phone VARCHAR(100) NOT NULL, FOREIGN KEY (user_id) REFERENCES user(id) ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE = INNODB; What I want to do is delete all records in the 'user_email' and 'user_phone' tables without deleting the record in the user table. I have a database without nearly 20 tables with one-to-one and one-to-many relationships with the user record and I need a way to cascade delete records in relationship tables.
Querying two tables with similar data   (228 Views)
I have two tables in my database "bannerclicks" and "bannerviews". They list the times a banner is clicked or viewed, respectively. They contain similar data, namely: bannerclicks -------------- id INT clickdate DATE bannerid INT bannerviews -------------- id INT viewdate DATE bannerid INT What would my query be if I wanted to display the months in which ANY activity took place (either a banner was clicked, or a banner viewed) I've been playing around with queries like this: Code: SELECT DISTINCT MONTH(bannerclicks.clickdate) AS clickmonth, MONTH(bannerviews.viewdate) AS viewmonth FROM bannerclicks, bannerviews WHERE bannerclicks.bannerid=2 AND bannerviews.bannerid=2 ... but it was all no good. In the end I decided to create one table "Banneractivity" with an additional "action" field to contain either "view" or "click". (in retrospect this is a much cleaner approach anyway) But I'm still curious, how would I solve this problem in the future
backing up a database?   (166 Views)
Just to see if it would work, I exported my database using phpmyadmin (as a SQL file), then I dropped the database. I also use a ulility (MYSQLautobackup) to do the same thing, only it emails me a gzip file. Now, when I try to import the emailed file, I get this (screenshot #1) But if I import the .sql file instead I get this (screenshot #2) and everything works. Am I doing something wrong