Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Database Name Quote and Value Quote 03 Oct 2011 17:48 #89

MySQL uses backticks `` for names and single quotes ‘‘ for values. On the generated component I got form Cook, I noticed that the databases does not have any quote at all.

There is a recommended way to work with this situation, by adding $db->nameQuote($name) to embrace names or values... a database query would be like this:
$query = "
  SELECT * 
    FROM ".$db->nameQuote('#__example_table')."  
    WHERE ".$db->nameQuote('id')." = ".$db->quote('999999').";
  ";

I think this would be a good thing to be added to follow the standards and avoid compatibility issues...
Paulo Griiettner
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

Re: Database Name Quote and Value Quote 05 Oct 2011 12:51 #103

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
You are right.

Sometimes, we used hard writed `, but never with the native function as you describe.

We will make a global check on this.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.350 seconds

For starters it's just so easy to design an app in a way that I'm used to i.e. database first then views followed by customization. The fork system is pure brilliance from a developer standpoint as I can override things and still add and update my projects with minimal effort! Truly amazing to be able to build components in Joomla using incremental refinement without having to do everything by hand. Thanks for the great tool! I am so much more productive now than ever and I can't imagine building components any other way!!!!
Dave (Forum)

Get Started