Jump to content

Query Execution Error and Single Quotes Questions


Recommended Posts

Hello everyone! I haven't messed with mySQL or PHP in a few years, and things apparently have changed quite a bit! In going back and updating an old site of mine, I find that my rating system is no longer working properly like it used to. I made no changes to it and it just stopped working, so I assume this is due to some type of outdated code.

 

I receive the following error when trying to update the rating database:

 

Could not execute query : Resource id #4.Access denied for user 'user'@'10.%' to database 'database'

 

I have checked and re-checked all of my passwords and account names and such, and I really can't figure out what's going on. The other parts of my site that work with the database have no problems accessing it and writing to it, it's only the Rating system that is having issues.

 

I imagine my code will need to be seen, but hopefully one of you experts can give me some information based on the error it's giving.

 

 

One more random question I had is regarding the entry of single quotes into text boxes for input into the database. If what I am putting in has a single quote in it anywhere, there's an error and the text isn't accepted. I figured out if I put a backslash in front of every instance of single quotes it'll go through, but that's kind of a pain and I know there's got to be an easier way.

 

 

Thanks so much for your time and help!

 

-b

For your first issue, yes the code would be helpful. Just redact any actual usernames/passwords. The second issue is caused by failure to properly escape your data wiht mysql_real_escape_string, which also means you're probably wide open to SQL injection attacks.

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.