Solved

problem with php script - truncate table - continued

Posted on 2010-08-23
8
540 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:skykuhl
8 Comments
 
LVL 142

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:skykuhl
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
 
LVL 142

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:skykuhl
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 142

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:skykuhl
ID: 33501277
Outstanding. Thanks very much. I don't know how I overlooked this earlier.

Thanks very much.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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 …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

757 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now