Solved

problem with php script - truncate table - continued

Posted on 2010-08-23
8
556 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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…

738 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