×
Kunena 5.1.5 Released - Security Release (14 Oct 2018)

The Kunena team has announce the arrival of Kunena 5.1.5 [K 5.1.5] which is now available for download as a native Joomla extension for J! 3.8.x. This version addresses most of the issues that were discovered in K 5.1 and issues discovered during the development stages of K 5.1. This is a Security release.

× This is for users to help other users, to discuss topics that are related to forum administration in general or problems in running Joomla. This is not the place to ask for Joomla support. If you want assistance with Joomla please ask at forum.joomla.org

Question MySQL Database Code load query question

  • C0n
  • C0n's Avatar Topic Author
  • Offline
  • Premium Member
  • Only the strongest will survive
More
6 years 9 months ago - 6 years 9 months ago #1 by C0n
So i see this allot through the joomla framework and i am curious to what the diffrence between running the code that contains
(int)$database->loadResult();

And
$database->loadResult();

No matter what one you use they both have the same output but i just can not find or figure out what the purpose of the "(int)" is ?

When i look around i find on PHP.net it is a integer of some kind for defining variables and functions. ( php.net/manual/en/language.types.integer.php )
Last edit: 6 years 9 months ago by C0n.

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

More
6 years 9 months ago #2 by xillibit
Hello,

by adding (int) your are that the variable $database->loadResult(); in an integer

I don't provide support by PM, because this can be useful for someone else.

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

  • C0n
  • C0n's Avatar Topic Author
  • Offline
  • Premium Member
  • Only the strongest will survive
More
6 years 9 months ago - 6 years 9 months ago #3 by C0n
So does it increase or decrease the queries performance ? Also i thought there should be a value for integers. not just (int) or it tells it to use a default value ?
Last edit: 6 years 9 months ago by C0n.

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

More
6 years 9 months ago #4 by Matias
It has no effect on performance, but simplifies code in the case if the query doesn't find an item. In that case it returns 0 and not NULL, which may need further check.

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

  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to add attachements.
  • Not Allowed: to edit your message.
Time to create page: 0.131 seconds