Jump to content

mrdhood

Members
  • Posts

    29
  • Joined

  • Last visited

    Never

Everything posted by mrdhood

  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".
  15. Hey I'm having issues with using strtotime(), date(), and time(). I have a couple problems. The first is: I used strtotime to get the unix of a specific date and time (worked great, even outputted the correct time using date() to return it). However when I went to post information on it (I set it up so that you can't post after the event started), it told me it already started like an hour before it was supposed to. I used if (time() > $event['when']) { echo "too late."; } else { do it } to determine. That had me very confused. Then I decided instead of manually inputting the event times I would pull them from an xml file, which I had no trouble reading. I used: strtotime("Next $day, $time PM") with $day = Sun, $time = 1:00- This outputted a unix timestamp but then date() returned it as being 7 pm on sunday instead. Any ideas what would be causing these strange things?
  16. I just opened a forum for sport discussion. I'm attempting to figure out how I want to have it, right now by going to http://www.sportsdiscussion.net you can see the two methods I'm considering. 1) {Sport} (ex: Basketball), Boards are "NBA", "NCAA" - will add a board for each league, like Football would have NFL, NCAA, Arena, United Football League, with each board having child boards for "News", "Teams (each team has a grandchild board)" "Players", "General Discussion". OR 2) Just hitting the main leagues as each category. Instead of Basketball just having "NBA" and then the 4 boards are on the index. Also I would like some feedback on the forum's theme and the site concept (do you think this will be successful? what do you think of the domain choice). If you are going to tell me I shouldn't have used SMF please explain why, instead of just saying "bad choice" or "should have used {other software}". Thank you, site: www.sportsdiscussion.net
  17. Main Object ( [Visitor] = Visitor Object ( [user_info] => Array ( [username] = user [user_id] = 1 ) ) [Room] = Room Object ( [info] = Array( [id] = 1 [name] = Lobby ) [messages] = Messages Object ( [messages] = Array ( [0] = Array() ) ) ) ) Is there a way to get the visitor info within the Messages Object? I'm building it such as $Main = new Main; $Main->Visitor = new Visitor; $Main->Room = new Room; $Main->Room->Messages = new Messages; so they're not static I know that I can pass the $this var through each but that duplicates the class each time and I'm 99% sure that's bad.
  18. search_array[0][1] returns Array ( 0 => array( 0 => '', 1 => 'THIS' ) ) or search_array[0][0][1] returns Array (0 => array (0 => array( 0 => '', 1 => 'THIS' ) ) ) Once you figure out which one of those gives you "tom" you can get cruise from changing 1 to 2 you can combine the two by doing something like var name = array[0] + " " + array[1]; you have to change "Array[0]" and "array[1]" to the right variables of course.
  19. $('head').append('<style>h1{ color: #000; }</style>'); Worked. This isn't really how I wanted to do it but I found that I don't think it's possible.
  20. I have a function that I need accessed two ways. The first way works which is with an ajax json request. it loads name(data) which then does alert(data['user_info']['username']); This works perfect. However I can't figure out how to set it up when a user clicks a span element it alerts their username. An exmaple code that I'm trying to use would be something like this: <span onclick="name('[\'user_info\':[\'username\':\'test\']]');">click</span> This will not work. alert(data); results in "['user_info':['username':'test']]" It won't convert it to an array. using new Array() did not help. (at least the way I tried). Thanks for any help. I did try to search, I'm probably doing some dumb mistake that I'm just overlooking.
  21. I've tried searching and I'm not sure if this is even possible due to the lack of (good) results. I'm trying to make it so that when you click a button the actual stylesheet changes. I want for example: <style>h1{ color: #aa000; }</style> <h1>Test</h1> would obviously make h1 have a font color of aa0000. Well I'm trying to make a button that changes that one to 00aa00 instead which is not a problem. Very easy actually especially since I use jquery. However I also create new h1 elements through ajax and those ones use the original aa0000 color because of the stylesheet. I want to know how to make new elements have the new color also.
  22. How can I assure that no user-submitted data messes with these functions? I use mysql_real_escape(), anything else?
  23. Jesus.. I feel like an idiot lol. Thank you guys. Sad thing is I use serialize in javascript for another part of the chat system.
  24. Yes. I'm making a chat room and instead of having 9 fields in the message table I have a couple and then user_info which consists of username=mrdhood&user_color=aa0000&message_color=aa0000 well the function I posted works great. Except now I got the idea to pass "actions" the same way except that one is gonna require arrays to be passed instead of strings.
×
×
  • 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.