Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8183599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:12:46+00:00 2026-06-07T01:12:46+00:00

I have used mysql mysql_real_escape_string($somevariable) in my code developed using Joomla! api. Everything is

  • 0

I have used mysql mysql_real_escape_string($somevariable) in my code developed using Joomla! api.
Everything is working perfectly except that this question is showing error.

mysql_real_escape_string(): Access denied for user 'www-data'@'localhost' (using password: NO) in /var/www/JOOMLA/components/com_quiz/models/questions.php

I searched on internet and got following solution:
create a $con=mysql_connect(....); and pass this as the 2nd parameter in mysql_real_escape_string($somevariable,$con) which works fine.

The thing is I am using Joomla API every where in my code.So ho can i use the default Joomla db object $db =& JFactory::getDBO(); for this??

Basically I want something like
$db =& JFactory::getDBO();
mysql_real_escape_string($somevariable,$db)

but it shows error:
mysql_real_escape_string() expects parameter 2 to be resource, object given in /var/www/JOOMLA/components/com_quiz/models/questions.php on line 85

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T01:12:47+00:00Added an answer on June 7, 2026 at 1:12 am

    If you’re using the Joomla database object to do your queries, why would you want to use the mysql library’s escaping function? You don’t need to. Follow this Joomla wiki entry which shows you how to create properly escaped SQL queries using their DBO.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a news feed that has been developed using PHP, MySQL, and jQuery.
I am very used to using MySQL and mysql_real_escape_string(), but I have been given
I have used full text search mysql. My code is select * from uh_property
I'm using mysql_real_escape_string to cleanse data that's used in insert and update queries (postal
I have to escape some inputs on a form. I used mysql_real_escape_string to escape
I want to use mysql with a rails app (I have never used mysql
I am new to MySQL, but I have used Oracle for some time. I
I used JPA and mysql. Each table have entity class.I have four tables. Table1
I will have multiple tables used by different projects on the same mySql server.
I have a MySQL database includes a table named 'Task'. and I used Hibernate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.