Jump to content

[SOLVED] PHP Variable loading from database, constantly checking?


Recommended Posts

I've been doing minor adjustments to my code lately and I was curious about the following...

 

1. Let's say we run $query = "select * from clients" (I'm suming up here... )

2. If I declare that $clientname=$query['clientname'];

3. I use the variable $clientname 10 times in my code.

 

Does it check the database ten times to find the clientname, or does it only check the first time to determine the variable value?

 

The reason I ask, I don't want to constantly check the database if it can be avoided... It may be very minimal, but I was lead to believe that using $query['clientname'] ten times would check the database each time.

 

Sometimes I use variable 50-100 times in my code I'm building.

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.