Jump to content

ether

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Everything posted by ether

  1. bubblegum.anarchy: Thanks! That seemed to of work
  2. This returns everything correctly, however. The field that I'm ordering by, `order`, has a NULL value by default so it brings ALL of the NULL values first, and then orders ASC on `order`. e.g. I know I can add to my WHERE clause with something like "AND `order` != NULL" but I _want_ records with a NULL value to show up, but just to be sorted to the bottom of the list when ORDERing BY. So really I want the ORDERing to start with '1'... I'm pretty sure I can use a PHP function, but I just cant seem to figure out which and I'd prefer to do it with SQL if possible. Thanks!
  3. As a final restort, I updated PHP on the production server to PHP5 and now it works. It must of been PHP4. Not quite sure why it was doing it. Thanks anyway guys.
  4. I have a website and two servers. A production server (PHP4) and a development (PHP5) server. Now, my code utilizes sessions for the users login and works flawlessly on both servers. I've just introduced a PM system and some AJAX functions (using jQuery). However, when I open a PM on the _production server_ for some reason my $_SESSION['username'] gets OVERWRITTEN by the name of the person who sent the PM. I cant work out for the love of god why it's doing it. It works perfectly on the development server so it has to be a PHP config. option or something, right? Somebody please help me.. Cheers, eth0.
  5. utexas_pjm: thank you! Your post helped me alot That code is fine, but say I want the navi class to access other classes, such as "session" and "logger". I'd have to initialize the classes and then do: $navi = new navi( $MySQL , $session , $logger ); right? This could get a bit messy if my "session" class also wants to access the "MySQL" and "logger" class, and so on. I've came up with a solution that works: class ifc0nfig { var $func = null; var $smarty = null; var $MySQL = null; var $navi = null; } class navi { var $ifc0nfig = null; function __construct( &$ifc0nfig ) { $this->ifc0nfig =& $ifc0nfig; } } and I initialize like so; $ifc0nfig = new ifc0nfig( ); $ifc0nfig->func = new func( &$ifc0nfig ); $ifc0nfig->smarty = new Smarty( ); $ifc0nfig->MySQL = new MySQL( params ); $ifc0nfig->navi = new navi( &$ifc0nfig ); and then within a class, lets say the navi class, I can access the MySQL class with $this->ifc0nfig->MySQL->some_method( ); Can anyone see anything wrong with this, any bad points etc?
  6. Daniel0: that works fine if I'm accessing $ifc0nfig->MySQL outside of a class, but if I'm in another class (navi) I cant access the MySQL object or even the ifc0nfig object (without class extends). The classes are in differant files (shouldn't matter?). Jenk: Not sure if I follow you here but making $_mysql private isn't going to help at all? I want other classes to be able to access it.
  7. I'm trying to keep everything manageable through multiple classes of which I can access all of them through one object ($ifc0nfig). mysql ------@ | ifc0nfig | | other classes--@----@----- navi If the navi class wants to run a MySQL query it'll have to go through the ifc0nfig class to get there, if you get my drift? ($ifc0nfig->MySQL->some_method( ).
  8. Thanks for the reply It does get initialized because MySQL _does_ establish a connection with the DB. Anyhow, there's no differance in using __construct.
  9. I'm trying to access a child class from a child class via a parent class, if that makes sense Here's what I've got: index.php require(ROOT_DIR . "ifc0nfig.php"); $ifc0nfig =& new ifc0nfig; ifc0nfig.php class ifc0nfig { public $func = NULL; public $smarty = NULL; public $MySQL = NULL; public $navi = NULL; function ifc0nfig( ) { require( ROOT_DIR . "functions.php" ); $this->func =& new func( ); require( ROOT_DIR . "mysql.php" ); $this->MySQL =& new MySQL( "localhost", "12345", "12345", "12345" ); require( ROOT_DIR . "navi.php" ) ; $this->navi =& new navi( ); // etc, etc } } From inside the Navi class I want to access the MySQL class, I've got class navi extends ifc0nfig {} (same with the MySQL class) and tried accessing the MySQL class differant ways but I just can't seem to access it. If I print_r( $this ); print_r( get_class_methods( $this ) ); I get You can see the variables are there, but they're just empty and I cant access them outside the ifc0nfig class. I'm not sure how to go about it, can anyone help? Thanks!
×
×
  • 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.