Solved

problem with php script - truncate table - continued

Posted on 2010-08-23
8
565 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The viewer will learn how to dynamically set the form action using jQuery.
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.

627 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