Jump to content

mrdhood

Members
  • Posts

    29
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mrdhood's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. echo "City: " . $city . "; Full State: " . $full_state . "; Zip: " . $zip; The . continues it.
  2. Oh, I've never gotten that message so I didn't even notice. It was just a quick little example anyways lol. Good to know though
  3. Closest you could do would be <?php class A { var $b; } class B extends A { function __construct() { $this->b = $this; } } I honestly don't see much point, as most of the time you don't need to access child classes. Another way would be class A { var $b; function __construct() { $this->b = new b; } } class b { function test() { echo 'test b'; } }
  4. $query = preg_replace('/{(.*?)}/e', '$tables[\'$1\']', $query); worked. thank you
  5. SELECT * FROM `{settings}` is the result of that echo with the regex from the last post.
  6. Ok I see the issue: yes it's outputting "$tables['settings']" but I need it to output the actual value.
  7. No it's outputting what I inputted: "SELECT * FROM `{settings}`" Execute($query): $query = "SELECT * FROM `{settings}`" Which is exactly what I told you it would be, I'm just trying to change {settings} to $tables['settings']
  8. In all honesty I don't know.. static function Execute($query) { $tables = self::$config['tables']; $subject='"SELECT * FROM `{settings}`"'; //echo self::$config['tables']['settings']; echo $tables['settings']; $query = preg_replace('/"SELECT \* FROM `\{([^}]+)\}`"/', '"SELECT * FROM `".$tables[\'\1\']"', $subject); echo $query . "<br />"; } is what I have right now. then I call Database::Execute("SELECT * FROM `{settings}`"); and it outputs this: Thank you for your help and patience thus far by the way.
  9. $tables = array( 'settings' => $prefix . 'settings', 'users' => $prefix . 'users' ); $query = "SELECT * FROM `{users}` WHERE `user_id`='" . $Visitor->user_id . "'"; // Should be $query = "SELECT * FROM `" . $tables['users'] . "` WHERE `user_id`='" . $Visitor->user_id . "'";
  10. I imagined it'd be something like: $query = preg_replace('`\{([^}]+)\}`', "self::$config['tables'][$1]", $query); but that errors as and $query = preg_replace('`\{([^}]+)\}`', '"self::$config[\'tables\'][$1]'", $query); as
  11. I was trying to use $1 :/. I had almost the same thing at one point. How would I go about just changing {table} to $tables[\1\]? That way the following examples wouldn't be bothered: SELECT `id` FROM `{table}` SELECT * FROM `{table}` WHERE `id`='1' and so on.
  12. I know this should be simple but I am terrible with preg_replace and keep returning blank results. I'm attempting to make "{table}" change to the value of $tables['table'], for example: "SELECT * FROM `{settings}`" would change to "SELECT * FROM `" . $tables['settings'] ."`
  13. I don't have the information from when time() and $event['when'] weren't working. 1322420400 is the int that strtotime("Next Sun, 1:00 PM") returns on my machine, is that the same on yours?
  14. Wouldn't let me edit, but that was suppose to read ".. to determine whether you can post or not".
×
×
  • 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.