Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
php, mysql, global, help

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side
View previous topic :: View next topic  
Author Message
unique



Joined: 29 Mar 2004
Posts: 655

PostPosted: 31.10.2004 18:28    Post subject: php, mysql, global, help Add user to your forum ignore list Reply with quote

znači ovako....
u svaki .php file inkludam condb.php koji služi za konekciju na db (mysql) - radi lakše promjene passworda username i ostalih sranja, znate kako to već ide...
uglavnom želio bi stavit da $konekt varijabla (zadužna za podatke o konekciji .... bla) bude globalna i pristupna svima...

condb.php
Code:
<?php
   global $konekt;
   $konekt = mysql_connect("localhost","smajli","bigmom");
   mysql_select_db("mydb",$konekt);
?>


to kolko vidim ne radi? u čem je problem?
sory ak sam glup Smile može objašnjenje?

_________________
Activate interlock! Dynotherms connected! Infracells up! Mega thrusters are go! LET'S GO VOLTRON FORCE!
Back to top
View user's profile Send private message
ivan



Joined: 08 Sep 2003
Posts: 320
Location: Zagreb

PostPosted: 31.10.2004 18:48    Post subject: Add user to your forum ignore list Reply with quote

mislim da ti varijabla $konekt samo dobije vrijednost 0 ili 1, ovisno o tome jel se uspio spojit ili ne

_________________
no ojro
Back to top
View user's profile Send private message Visit poster's website
unique



Joined: 29 Mar 2004
Posts: 655

PostPosted: 31.10.2004 19:08    Post subject: Add user to your forum ignore list Reply with quote

ivan wrote:
mislim da ti varijabla $konekt samo dobije vrijednost 0 ili 1, ovisno o tome jel se uspio spojit ili ne

hmmm mislim da ne... ne znam nebi imalo smisla Smile

_________________
Activate interlock! Dynotherms connected! Infracells up! Mega thrusters are go! LET'S GO VOLTRON FORCE!
Back to top
View user's profile Send private message
che.UP
mi3.crew


Joined: 07 Sep 2003
Posts: 2320
Location: zagreb

PostPosted: 31.10.2004 19:09    Post subject: Add user to your forum ignore list Reply with quote

pa lupi echo na nju pa ces vidit :)

_________________
UP | TypeTester | Accommodations App
Meni u Firefox-u ne radi AJAX
Back to top
View user's profile Send private message Visit poster's website
silence



Joined: 24 Apr 2004
Posts: 890
Location: .....ni na nebu, ni na zemlji.....

PostPosted: 31.10.2004 19:10    Post subject: Add user to your forum ignore list Reply with quote

ne kužim onaj dio di bi trebala biti pristupna svima....kaj točno hoćeš?
malo me taj dio muči.....

_________________
This End-User License is an agreement between Microsoft Corporation (hereafter referred to as "Microsoft") and you, the end-user (hereafter referred to as "our bitch").
Back to top
View user's profile Send private message Visit poster's website
unique



Joined: 29 Mar 2004
Posts: 655

PostPosted: 31.10.2004 19:12    Post subject: Add user to your forum ignore list Reply with quote

silence wrote:
ne kužim onaj dio di bi trebala biti pristupna svima....kaj točno hoćeš?
malo me taj dio muči.....

na početku koda inkludam to...
i želim ga koristit u svim funkcijama koje trebaju neš iz db... mora bit onda global? ne?
mogu u svaku funkciju to inkludat ali ovo mi je bolji način ...

_________________
Activate interlock! Dynotherms connected! Infracells up! Mega thrusters are go! LET'S GO VOLTRON FORCE!
Back to top
View user's profile Send private message
che.UP
mi3.crew


Joined: 07 Sep 2003
Posts: 2320
Location: zagreb

PostPosted: 31.10.2004 19:15    Post subject: Add user to your forum ignore list Reply with quote

ma vjerojatno hoce koristit tu varijablu kao link_identifier za koristenje mysql_query funkcije...
meni to sljaka, a ne znam zato njemu nece...

daj primjer nekog koda...

_________________
UP | TypeTester | Accommodations App
Meni u Firefox-u ne radi AJAX
Back to top
View user's profile Send private message Visit poster's website
unique



Joined: 29 Mar 2004
Posts: 655

PostPosted: 31.10.2004 19:16    Post subject: Add user to your forum ignore list Reply with quote

che.UP wrote:
pa lupi echo na nju pa ces vidit Smile

lupih print i ... Resource id #1

sad sam zbunjen Smile

_________________
Activate interlock! Dynotherms connected! Infracells up! Mega thrusters are go! LET'S GO VOLTRON FORCE!
Back to top
View user's profile Send private message
che.UP
mi3.crew


Joined: 07 Sep 2003
Posts: 2320
Location: zagreb

PostPosted: 31.10.2004 19:17    Post subject: Add user to your forum ignore list Reply with quote

unique wrote:

na početku koda inkludam to...
i želim ga koristit u svim funkcijama koje trebaju neš iz db... mora bit onda global? ne?
mogu u svaku funkciju to inkludat ali ovo mi je bolji način ...


a fuuuuunkciju...... moras onda u njoj na pocetku rec global $konekt; pa ce ti radit... u svakoj funkciji, jelte :)

_________________
UP | TypeTester | Accommodations App
Meni u Firefox-u ne radi AJAX
Back to top
View user's profile Send private message Visit poster's website
Sulien



Joined: 04 Jan 2004
Posts: 2905
Location: Zagreb

PostPosted: 31.10.2004 19:19    Post subject: Add user to your forum ignore list Reply with quote

'global' se ne koristi na tom mjestu gdje si ga ti stavio

npr. ako imas funkciju proba() koja zeli pristupiti varijabli $test koja je deklarirana negdje drugdje
Code:
function proba(){
    global $test;
    echo $test;
}

Ja sam se isto na početku php-a tako zbunio kao i ti, pa sam pogledao
http://www.php.net/language.variables.scope

PHP.NET is your FRIEND


EDIT: sad vidim da me Che pretekao Smile

Last edited by Sulien on 31.10.2004 19:20; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
unique



Joined: 29 Mar 2004
Posts: 655

PostPosted: 31.10.2004 19:19    Post subject: Add user to your forum ignore list Reply with quote

che.UP wrote:
unique wrote:

na početku koda inkludam to...
i želim ga koristit u svim funkcijama koje trebaju neš iz db... mora bit onda global? ne?
mogu u svaku funkciju to inkludat ali ovo mi je bolji način ...


a fuuuuunkciju...... moras onda u njoj na pocetku rec global $konekt; pa ce ti radit... u svakoj funkciji, jelte Smile


ti čitaš od kraja ili Smile
to sam i napravio...

_________________
Activate interlock! Dynotherms connected! Infracells up! Mega thrusters are go! LET'S GO VOLTRON FORCE!
Back to top
View user's profile Send private message
unique



Joined: 29 Mar 2004
Posts: 655

PostPosted: 31.10.2004 19:21    Post subject: Add user to your forum ignore list Reply with quote

Sulien wrote:
'global' se ne koristi na tom mjestu gdje si ga ti stavio

npr. ako imas funkciju proba() koja zeli pristupiti varijabli $test koja je deklarirana negdje drugdje
Code:
function proba(){
    global $test;
    echo $test;
}

Ja sam se isto na početku php-a tako zbunio kao i ti, pa sam pogledao
http://www.php.net/language.variables.scope

PHP.NET is your FRIEND


EDIT: sad vidim da me Che pretekao Smile


aha Smile čudno ... tenks

@che .... a-h-a Wink sory Smile

_________________
Activate interlock! Dynotherms connected! Infracells up! Mega thrusters are go! LET'S GO VOLTRON FORCE!
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Server-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group