Solved

problem with php script - truncate table - continued

Posted on 2010-08-23
8
551 Views
Last Modified: 2013-12-13
Greetings,

This is a follow on question to http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/PHP_Databases/Q_26422114.html

I get this sql error message:

DROP command denied to user 'themaury_reapp'@'localhost' for table 'features_tab'

This has been occuring since I moved this site to a new server.  So I think I need to modify some permissions.

Can anyone advise me?

Thanks very much.

Sky
0
Comment
Question by:Schuyler Kuhl
8 Comments
 
LVL 143

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 250 total points
ID: 33500846
>  So I think I need to modify some permissions.
yes. either your new host allows you to grant the "drop table" permission to the login you use to connect (which should not be a problem, as you also create the tables, right?) , or you change the "truncate table" into a "delete tablename" ...
0
 
LVL 3

Expert Comment

by:grantunwin
ID: 33500895
Use thoe following SQL statement

"GRANT DROP ON features_tab TO themaury_reapp";
0
 

Author Comment

by:Schuyler Kuhl
ID: 33500944
Does delete remove the data of the table and retain the structure?

Also isn't drop actually used to delete the table completely?  

I use cpanel but I can't see where to modify these permissions. You can just add a user to the database but I don't see that there are any further settings for that user.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 33500982
>Does delete remove the data of the table and retain the structure?
yes.
truncate table does the same, but requires the drop table permissions ...
0
 

Author Comment

by:Schuyler Kuhl
ID: 33501058
Ok I just looked it up.  I see that the delete command can be used to just delete specific records.

mysql_query("DELETE FROM example WHERE age='15'")

Would this delete all records: mysql_query("DELETE FROM example'")

Is there a limitation to the number of records?

thank you.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 33501129
>Would this delete all records: mysql_query("DELETE FROM example'")

yes

>Is there a limitation to the number of records?

no
0
 
LVL 11

Accepted Solution

by:
RedLondon earned 250 total points
ID: 33501220
To use cPanel to grant the permission to DROP, or just to see which permissions your user has, log into www.your-site.com/cpanel with your account username and password (ie the same details you'd use for FTP - not the MySQL username/password)

Click on the "MySQL Databases" icon in the "Databases" box

There's a table that shows your databases, the first column lists the database names, the second the usernames with access to that database, and then a Delete Database link in the third column

Click the username beside the database you're working with (the username itself, not the red cross beside it)

You now see a list of checkboxes showing the permissions you have, and can select from SELECT, CREATE, INSERT, ALTER, UPDATE, DROP, DELETE, LOCK TABLES, INDEX, REFERENCES, CREATE TEMPORARY TABLES, & CREATE ROUTINE as necessary, or select 'ALL PRIVILEGES' if necessary.
0
 

Author Comment

by:Schuyler Kuhl
ID: 33501277
Outstanding. Thanks very much. I don't know how I overlooked this earlier.

Thanks very much.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question