The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

PHP/SQL question. by dodrian2008-09-15 06:50:08
  Did you check context for 'user' is (or includes) by Acrisius2008-09-15 08:02:53
    Yeah, it wasn't defined. by dodrian2008-09-15 08:25:44
      That was the problem. by dodrian2008-09-15 08:32:41
        A note about globals: by EnzoMatrix 2008-09-15 11:30:17
They're considered bad practice... In the end you're usually better off by passing values through parameters of a function, and stick to some variables at the start of your displying page.
for example something like

$dbConn0 = mysql_connect($dbHost, $dbUser, $dbPass);

at the beginning of your showing .php page should be ok.
But if do implement an include that contains helper functions, never assume the globals are there. That also helps portability of said functions.

The only exception I make is const.php that contains (among other things) the sql parameters..
But even then I pass those values to functions through parameters.
[ Reply ]

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)