If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

db delete row permission

Hi i did some code changes to my admin area so that i had the option of either truncating the table all together (which i used to do thru phpMyAdmin all the time once a day) or deleting individual rows.

Problem is that my truncate works fine but my individual row del query does nothing. I know the code is correct because as a test i even used a query that i know worked but just changed the value of rowid.

I know the id has value, i know the variable has value. That is all correct.

So that leaves me to believe that for some reason i may have permission to truncate but not permission for row deletion. Im not even sure this is possible thats why im asking.

Do i need to set permissions in php for this or is it a phpMyAdmin deal. Im sort of lost on this one, ok fine not "sort of" but totally . I dont remember running into this before.

You just said $rid was a string, not a number. You need to wrap that where clause field comparison with quotations then. Errors with E_ALL will mean nothing if whatever this statement class is doing doesn't issue anything on a failure. So this would indicate to me that the Statement class needs work to determine if it failed.

@ guelphdad - it does not make sense there is nothing special about that table that you would have to convert anything in order to del a row. Lets say i wanted to delete a user with the sha1 password of some encrypted value, it would not matter, all i have to do is say delete from table where password = "the encrypted value" hard coded and it delets the row.

So even if it is a sha1 value i would not matter.

@Fou-Lu

i tried =".$val." and ="$val" and ='$val' and '.$val.' just to see if i could get something to register and nothing all it gave me was errors if i changed it to anything other than ='.$val;

i even tried WHERE id=3a226b173e49ffd3d32d416174455354;
and WHERE id="3a226b173e49ffd3d32d416174455354" which are both live connection values

Although your variables themselves are incorrect. You'll pull a syntactical error when you attempt to run DELETE FROM chat_ connections. You also shouldn't pull any variables from globals, but at least this way you will trigger E_NOTICE when they don't exist (unlike global).

is it part of concatenation? i noticed there is a space before the second dot is that required? i would like to read about this in the docs if its there and learn how to read this properly, im sure i will run into this again.

@ guelphdad - it does not make sense there is nothing special about that table that you would have to convert anything in order to del a row. Lets say i wanted to delete a user with the sha1 password of some encrypted value, it would not matter, all i have to do is say delete from table where password = "the encrypted value" hard coded and it deletes the row.

Perhaps I wasn't clear then. What I meant was perhaps you were passing the string 'apples' when you needed to pass SHA1('apples') to match what was in the table.

Glad you have it figured out.

your question above about concatenation is correct that is all you are doing. The space after the . does not matter except for readability.

This ^
All about how I like to show my formatting, spaces IMO are required (IMO, not in the parser's opinion). I'd personally use sprintf or binding myself though, but in a concat it's always string - period - space - variable - space - period - string.
Looks like I missed a space up there too :/

Well im glad something positive came from my question, yep you learn something new every day wether you really want to or not lol in this business..

@Old Pedant, its so funny that at one time it struck me to split that up as you did, not because of my tech savy but just because i wondered if it would work that way, i did not try it but i wish i had. How about that, even some of my hair brained ideas sometimes actually do work and are not so hair brained after all lol...