Jump to content

Aureole

Members
  • Posts

    788
  • Joined

  • Last visited

    Never

Everything posted by Aureole

  1. I haven't started yet, I took a Day break from coding. Once I've got something together I'll post the code.
  2. Ok I have a problem, I'm not going to post all of the class(es)... just the relevant part(s)... <?php class equinox { /** * Variables from conf.php * @var [array] */ var $vars; function init_db() { require_once( 'class_database.' . $this->vars['php_ext'] ); $this->database = new database; $this->database->equinox =& $this; $this->database->connect(); } function dump_vars( $dump_db_vars = 0 ) { foreach($this->vars as $key => $val) { if( $dump_db_vars == 0 ) { if ( substr( $key, 0, 2 ) !== 'db' ) { echo( "<strong>$key: </strong>$val<br>\n" ); } } else { echo( "<strong>$key: </strong>$val<br>\n" ); } } } } ?> Then the database class is as follows... <?php class database { function connect() { print_r( $this->equinox->dump_vars() ); $db_connect = mysql_connect( $this->equinox['db_host'], $this->equinox['db_user'], $this->equinox['db_pass'] ); echo( $db_connect ) ? 'Success' : mysql_error(); } } ?> When I do the print_r(), it does it twice for some reason... I think maybe I've created another instance of the equinox class within the database class... that's not what I wanted to do, I just want it to be passed along so I can use the $equinox->vars stuff as that contains the database information... I don't have PHP 5, so keep that in mind... my PHP version is in my signature.
  3. I know what you mean, I always make stupid mistakes at stupid times. It's 7:33 AM and I've been coding since like 11 PM...
  4. You could try something like... [code <?php function searchQuery($urlPart) { global $query; // etc... } ?> ...but apparently, "globals are bad". Try it though.
  5. This might work... str_replace( "\n\n", "\n", $t ); ... where $t is the content of the file. I'm assuming that the space between the table and the tr tag (etc.) is created by 2 \n... though I could be wrong.
  6. This might help, I have a main class, this is a function from within that class: <?php function init_session() { require_once( ROOT_PATH . 'classes/class_session.php' ); $this->session = new session; // Note the following line... $this->session->equinox =& $this; $this->session->check(); } ?> The class is called equinox, however within my session class (which is instantiated inside the equinox class) I can use equinox's methods via $session->equinox... if that makes sense?
  7. I don't have a clue what's going on there...
  8. I really don't get what you're asking, sorry... hopefully someone else will.
  9. Now there's something I can cope with, I use jQuery... and I like it... it's just normal Javascript that I despise. So, doing what I'm trying to do would be easier with jQuery then?
  10. In case you don't understand the difference between != and !== <?php // In PHP, both of these mean true... $a = true; $b = 1; // Both $a and $b are true, but !== also checks to see if they are of the same type, $a is a boolean and $b is an integer. if( $a !== $b ) echo( 'false' ); // Will return false. ?>
  11. Well you probably know more than me, so I'll just take your word for it.
  12. Yeah... I guess so. I'm still miles away from accomplishing what I set out to do, but hey... it's Javascript... I expected as much. I really hate it, I don't know why. Thanks for the help any who... Does anyone have any idea how to loop through all elements that have the same class then for each one do stuff?
  13. How can selecting EVERYTHING from a table be quicker than/the same as selecting only one thing?
  14. I use arrays a lot without knowing how big they are etc... you need to explain in more detail... Though you do realize there are functions that can count how big an array is etc.
  15. Uhh... <form method="post" action="commentsadminedit21.php?idedit=<?php echo( $idedit ); ?>">
  16. Why are you selecting *... that is overkill... you only need to select one thing, e.g. the id... EDIT: I don't think he was saying the function was overkill, he was saying SELECT * was overkill when a simple SELECT `id` or SELECT `column` would do.
  17. I changed the test.php file to exactly what you said and the output is now "Monday 4th Feb 2008, 10:53 PM EST" ... eh? I'm pretty darn certain that I entered the time-stamp correctly before. But anyway if you remember when we first created the time-stamp with Javascript the date was "02.04.2008 7:53 PM PST" I'm fairly certain that "02.04.2008 7:53 PM PST" is not "Monday 4th Feb 2008, 10:53 PM EST" I thought PST was GMT - 6 and EST was GMT - 5... I hate dates/times, no fun! Well I don't actually want to do anything with PHP, I was just testing the time-stamp as I feel ok using PHP where as Javascript scares me...
  18. I'm sorry, I've never been good with date/time stuff. It outputs: Monday 4th Feb 2008, 2:53 AM EST
  19. It gave me: Monday 4th Feb 2008, 2:53 AM, the original was: 02.04.2008 7:53 PM PST So it's close-ish... I just realized I need to change the day and month around in the date() function in test.php... but even after changing that it'll still be off slightly. I saw that, but I didn't understand what you meant at first... Javascript... ugh.
  20. I did what you said above, then it gave me the time-stamp "1202183580000". I then created a php file called test.php. Inside test.php I have: <?php echo( date( 'l jS M Y, g:i A', $_GET['t'] ) ); ?> I went to test.php?t=1202183580000 in my Browser and the output was: Monday 18th Jan 2038, 10:14 PM ...something's not right there.
  21. Is that there time-stamp taking into account whether it's AM or PM?
  22. That gives me NaN. ??? Basically, here's what I'm going to do: #1 Loop through all <li> that have a class of "date" #2 For each one of those, do whatever I need to (e.g. splitting) to get it into a format I can work with #3 Change the date depending on a var e.g. If the var is 0, then that means GMT. The date contained within the <li> will ALWAYS be PST. So it will do the maths to convert the PST date to GMT then set that <li>'s innerHTML to the new Date then go onto the next <li> If the var is -5, then that means EST etc. etc. I'm probably going about this whole thing the wrong way, but it doesn't matter to me... I just want to get it working.
  23. Alright, I have this: var date = '02.04.2008 7:53 PM PST'; var splitdate = date.split(' '); var mdy = splitdate[0].split('.'); var month = mdy[0]; var day = mdy[1]; var year = mdy[2]; var hm = splitdate[1].split(':'); var hours = hm[0]; var minutes = hm[1]; var ampm = splitdate[2]; document.write("Month: " + month); document.write("Day: " + day); document.write("Year: " + year); document.write("Hours: " + hours); document.write("Minutes: " + minutes); document.write("AM/PM: " + ampm); This works, now is there anyway I can create a UNIX timestamp with Javascript? If not then I'll just have to do something else.
  24. I'll try it myself, but I've only just started learning Javascript today so I might get stuck, but thanks for the help so far. Alright, I need to split... (the numbers may change, but you get the idea)... 02.04.2008 7:53 PM PST into... 02.04.2008 7:53 PM PST ...then split... 02.04.2008 ...into... 02 04 2008 ...then split... 7:53 ...into... 7 53 Then I think I'll be able to work with the Javascript date/time functions after that.
×
×
  • 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.