the same variables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
duk
Forum Contributor
Posts: 199
Joined: Wed May 19, 2004 8:45 am
Location: London

the same variables

Post by duk »

hy

if in all my pages... i have the same variable to sql querys... like this one

Code: Select all

<?php
$comando = "update test SET id='$id_clan' where id='$id_test'";

$executa_comando = mysql_query("db", $comando);


?>
in all my pages i use the var $comando...

if in the same time 3 users, in 3 diferent pages, made a query to the mysql db, i will have some problems ????

becouse will be 3 query's with the same var name...

ill need to use mysql_free_result, or this error will never exists ???
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

English?
User avatar
Saethyr
Forum Contributor
Posts: 182
Joined: Thu Sep 25, 2003 9:21 am
Location: Wichita, Kansas USA
Contact:

Post by Saethyr »

You should not have problems as the variable will be unset automatically by php when that script terminates.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Illusionist wrote:English?
Politeness and try to help?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

You shouldn't have a problem. Yes each user will have their own query named the same, but it's stored with their process. When a user accesses a page, a process for generating that page is created. All variables and the like that are created in that process, are only accessible through that process. So, the server and PHP won't get confused when multiple processes (or users) have identically named variables.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

patrikG wrote:
Illusionist wrote:English?
Politeness and try to help?
Help what? i couldn't tell what he was asking. Was he asking if he was going ot have problems? Or was he asking if mysql_free_results would fix the error. Well what error? And by the way hes last sentence is worded it is as if he is saying if he uses mysql_free_result onlt then will he get an error...
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

My point was more about politeness. Not everyones first language is English (heck, it's not mine for sure) and with some good will duk's post makes sense. Ambiguities can be narrowed down and, if you don't understand a post, simply ask the bits you don't understand.

As is, a simple "English?" is flippant, doesn't help with the problem and thus is unecessary to post.
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

It's not good English, either.
Post Reply